1. git remote -v
  2. git remote add 别名 地址
  3. git fetch 别名
  4. git merge  别名/分支

第一步:命令行进入到本地.git 所在的目录,查看remote 信息 ,只有 fork

  1. >git remote -v
  2. origin https://github.com/gcontini/xades4j.git (fetch)
  3. origin https://github.com/gcontini/xades4j.git (push)

第二步:添加一个remote ,别名是 upstream ,地址是源项目地址

  1. >git remote add upstream https://github.com/luisgoncalves/xades4j.git

执行完毕之后 \.git\config 文件中增加了三行

  1. [remote "upstream"]
  2. url = https://github.com/luisgoncalves/xades4j.git
  3. fetch = +refs/heads/*:refs/remotes/upstream/*

第三步:查看remote 信息 ,有两个,一个是origin(本地项目从哪来的),另一个是upstream(最原始的项目)

  1. >git remote -v
  2. origin https://github.com/gcontini/xades4j.git (fetch)
  3. origin https://github.com/gcontini/xades4j.git (push)
  4. upstream https://github.com/luisgoncalves/xades4j.git (fetch)
  5. upstream https://github.com/luisgoncalves/xades4j.git (push)

第四步:获取原项目的信息

  1. >git fetch upstream
  2. remote: Counting objects: , done.
  3. remote: Total (delta ), reused (delta ), pack-reused
  4. Unpacking objects: % (/), done.
  5. From https://github.com/luisgoncalves/xades4j
  6. * [new branch] gh-pages -> upstream/gh-pages
  7. * [new branch] master -> upstream/master

执行完毕之后 \.git\refs\remotes\ 文件夹下增加了 upstream 文件夹,其中包含两个分支文件

  1. └─upstream
  2. gh-pages
  3. master

第五步:合并分支(合并remotes\upstream\master 文件中的内容到本地)

  1. >git merge upstream/master
  2. Auto-merging src/test/java/xades4j/verification/XadesVerifierImplTest.java
  3. CONFLICT (content): Merge conflict in src/test/java/xades4j/verification/XadesVerifierImplTest.java
  4. Automatic merge failed; fix conflicts and then commit the result.

第六步: 处理冲突文件

第七步: push到 fork

备注:

查看帮助信息

-h 简要帮助信息

--help 通过浏览器打开文档,显示详细信息

  1. >git remote -h
  2. usage: git remote [-v | --verbose]
  3. or: git remote add [-t <branch>] [-m <master>] [-f] [--tags | --no-tags] [--mirror=<fetch|push>] <name> <url>
  4. or: git remote rename <old> <new>
  5. or: git remote remove <name>
  6. or: git remote set-head <name> (-a | --auto | -d | --delete | <branch>)
  7. or: git remote [-v | --verbose] show [-n] <name>
  8. or: git remote prune [-n | --dry-run] <name>
  9. or: git remote [-v | --verbose] update [-p | --prune] [(<group> | <remote>)...]
  10. or: git remote set-branches [--add] <name> <branch>...
  11. or: git remote get-url [--push] [--all] <name>
  12. or: git remote set-url [--push] <name> <newurl> [<oldurl>]
  13. or: git remote set-url --add <name> <newurl>
  14. or: git remote set-url --delete <name> <url>
  15.  
  16. -v, --verbose be verbose; must be placed before a subcommand

remote -h

  1. >git fetch -h
  2. usage: git fetch [<options>] [<repository> [<refspec>...]]
  3. or: git fetch [<options>] <group>
  4. or: git fetch --multiple [<options>] [(<repository> | <group>)...]
  5. or: git fetch --all [<options>]
  6.  
  7. -v, --verbose be more verbose
  8. -q, --quiet be more quiet
  9. --all fetch from all remotes
  10. -a, --append append to .git/FETCH_HEAD instead of overwriting
  11. --upload-pack <path> path to upload pack on remote end
  12. -f, --force force overwrite of local branch
  13. -m, --multiple fetch from multiple remotes
  14. -t, --tags fetch all tags and associated objects
  15. -n do not fetch all tags (--no-tags)
  16. -j, --jobs <n> number of submodules fetched in parallel
  17. -p, --prune prune remote-tracking branches no longer on remote
  18. --recurse-submodules[=<on-demand>]
  19. control recursive fetching of submodules
  20. --dry-run dry run
  21. -k, --keep keep downloaded pack
  22. -u, --update-head-ok allow updating of HEAD ref
  23. --progress force progress reporting
  24. --depth <depth> deepen history of shallow clone
  25. --shallow-since <time>
  26. deepen history of shallow repository based on time
  27. --shallow-exclude <revision>
  28. deepen history of shallow clone, excluding rev
  29. --deepen <n> deepen history of shallow clone
  30. --unshallow convert to a complete repository
  31. --update-shallow accept refs that update .git/shallow
  32. --refmap <refmap> specify fetch refmap
  33. -4, --ipv4 use IPv4 addresses only
  34. -6, --ipv6 use IPv6 addresses only

fetch -h

源项目 -> fork -> 本地 (如何把源项目的代码合并到本地然后推送给fork)的更多相关文章

  1. 如何在IDEA里给大数据项目导入该项目的相关源码(博主推荐)(类似eclipse里同一个workspace下单个子项目存在)(图文详解)

    不多说,直接上干货! 如果在一个界面里,可以是单个项目 注意:本文是以gradle项目的方式来做的! 如何在IDEA里正确导入从Github上下载的Gradle项目(含相关源码)(博主推荐)(图文详解 ...

  2. Spring3 + Spring MVC+ Mybatis 3+Mysql 项目整合(注解及源码)

    Spring3 + Spring MVC+ Mybatis 3+Mysql 项目整合(注解及源码) 备注: 之前在Spring3 + Spring MVC+ Mybatis 3+Mysql 项目整合中 ...

  3. idea中编译项目报错 java: javacTask: 源版本 1.8 需要目标版本 1.8

    问题如上面所叙: > idea中编译项目报错 java: javacTask: 源版本 1.8 需要目标版本 1.8 解决方案: > Setting->Compiler->Ja ...

  4. Visual Studio 2015开发Qt项目实战经验分享(附项目示例源码)

    Visual Studio 2015开发Qt项目实战经验分享(附项目示例源码)    转 https://blog.csdn.net/lhl1124281072/article/details/800 ...

  5. 编译最新版webrtc源码和编译好的整个项目10多个G【分享】

    编译最新版webrtc源码和编译好的整个项目10多个G[分享] 参考https://webrtc.org/native-code/development/编译最新版webrtc源码: Git clon ...

  6. 使用 IDEA 创建 SpringBoot 项目(详细介绍)+ 源码案例实现

    使用 IDEA 创建 SpringBoot 项目 一.SpringBoot 案例实现源码 二.SpringBoot 相关配置 1. 快速创建 SpringBoot 项目 1.1 新建项目 1.2 填写 ...

  7. 在使用 Fortify进行源码扫描时需要做对项目需要做什么?

    1.一般我们的项目都是svn 或git 进行管理的,为了扫出异常的问题 做好把   “” .svn    “”  文件删除 2.把我们的项目需要的jar 文件放到一个文件夹内同项目一起进行扫描.这样为 ...

  8. gitlab或github下fork后如何同步源的新更新内容?

    两种方式: 项目 fetch 到本地,通过命令行的方式 merge 懒人方法,只用 Github ,不用命令行 1.项目 fetch 到本地,通过命令行的方式 merge 提示:跟上游仓库同步代码之前 ...

  9. Spring5源码解析-前奏:本地构建Spring5源码

    构建环境 macOS 10.13.6 JDK1.8 IntelliJ IDEA 2018.3.6 (Ultimate Edition) Spring v5.1.9.RELEASE Gradle 5.5 ...

随机推荐

  1. 36-2018 蓝桥杯Java B组试题及答案

    1:第几天2000年的1月1日,是那一年的第1天.那么,2000年的5月4日,是那一年的第几天? 注意:需要提交的是一个整数,不要填写任何多余内容. 用excel算,答案125. 2.标题:方格计数 ...

  2. Oracle Telnet 1521 失败

    作中发现自己的电脑“telnet 127.0.0.1 1521”(注意:不要拼成telnet 127.0.0.1:1521 ) 可以通过,但是使用localhost.主机名来telnet,则失败. 解 ...

  3. 梦殇 chapter five

    一弦情殇未谱,半纸离愁难书,不记年,叹花开几度...... 蜡烛用它自己的死亡来温暖别人,奉献自己的同时,它内心是快乐的吗?那残留的蜡油是它的泪水,还是它快乐的预兆? 这个世界上除了父母家人外,会有真 ...

  4. 访问WebServcie遇到配额不足的时候,请增加配额

    常常遇到的报错: 1.错误一: Error in deserializing body of reply message for operation 'GetArticleInfo'.,StackTr ...

  5. 基于kafka-net实现的可以长链接的消息生产者

    今天有点时间,我就来说两句.最近接触的Kafka相关的东西要多一些,其实以前也接触过,但是在项目使用中的经验不是很多.最近公司的项目里面使用了Kafka消息中间件,由于以前的人员编写的客户端的类不是很 ...

  6. ftp上传文件异常

    ftp一个服务器 如果是22端口 ssh-2.0-openssh_4.3 ,是什么意思? ftp服务用的是20.21端口,客户端添加ftp信息的时候输入的是21端口 ssh服务用的是22端口,应用于远 ...

  7. virtaulbox docker虚拟机使用主机代理shandowsocks

    1.virtaulbox 配置NatNetwork File->Preference->network->add new nat network 2.virtaulbox 虚拟机配置 ...

  8. ORM学员管理系统单表查询示例

    前期准备工作 首先创建好一个项目 一:必须使用MySQL创建一个库 因为ORM只能对表和数据进行处理,所以库必须自己创建 create database mysite; 二:进行相关的配置 在项目my ...

  9. Introduction to 3D Game Programming with DirectX 11 翻译--开篇

    Direct3D 11简介 Direct3D 11是一个渲染库,用于在Windows平台上使用现代图形硬件编写高性能3D图形应用程序.Direct3D是一个windows底层库,因为它的应用程序编程接 ...

  10. 洛谷1312 Mayan游戏

    原题链接 讨厌这种大搜索题 基本就是模拟搜索,注意细节即可. 以下是我用的两个剪枝: 将块向左移的前提是左边为空,因为该题要求先右后左,所以若左边有块,那么在上一次搜索向右移的时候一定会搜过,且字典序 ...