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

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

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

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

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

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

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

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

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

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

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

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

└─upstream
gh-pages
master

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

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

第六步: 处理冲突文件

第七步: push到 fork

备注:

查看帮助信息

-h 简要帮助信息

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

>git remote -h
usage: git remote [-v | --verbose]
or: git remote add [-t <branch>] [-m <master>] [-f] [--tags | --no-tags] [--mirror=<fetch|push>] <name> <url>
or: git remote rename <old> <new>
or: git remote remove <name>
or: git remote set-head <name> (-a | --auto | -d | --delete | <branch>)
or: git remote [-v | --verbose] show [-n] <name>
or: git remote prune [-n | --dry-run] <name>
or: git remote [-v | --verbose] update [-p | --prune] [(<group> | <remote>)...]
or: git remote set-branches [--add] <name> <branch>...
or: git remote get-url [--push] [--all] <name>
or: git remote set-url [--push] <name> <newurl> [<oldurl>]
or: git remote set-url --add <name> <newurl>
or: git remote set-url --delete <name> <url> -v, --verbose be verbose; must be placed before a subcommand

remote -h

>git fetch -h
usage: git fetch [<options>] [<repository> [<refspec>...]]
or: git fetch [<options>] <group>
or: git fetch --multiple [<options>] [(<repository> | <group>)...]
or: git fetch --all [<options>] -v, --verbose be more verbose
-q, --quiet be more quiet
--all fetch from all remotes
-a, --append append to .git/FETCH_HEAD instead of overwriting
--upload-pack <path> path to upload pack on remote end
-f, --force force overwrite of local branch
-m, --multiple fetch from multiple remotes
-t, --tags fetch all tags and associated objects
-n do not fetch all tags (--no-tags)
-j, --jobs <n> number of submodules fetched in parallel
-p, --prune prune remote-tracking branches no longer on remote
--recurse-submodules[=<on-demand>]
control recursive fetching of submodules
--dry-run dry run
-k, --keep keep downloaded pack
-u, --update-head-ok allow updating of HEAD ref
--progress force progress reporting
--depth <depth> deepen history of shallow clone
--shallow-since <time>
deepen history of shallow repository based on time
--shallow-exclude <revision>
deepen history of shallow clone, excluding rev
--deepen <n> deepen history of shallow clone
--unshallow convert to a complete repository
--update-shallow accept refs that update .git/shallow
--refmap <refmap> specify fetch refmap
-4, --ipv4 use IPv4 addresses only
-6, --ipv6 use IPv6 addresses only

fetch -h

最新文章

  1. 搭建一套自己实用的.net架构(2)【日志模块-log4net】
  2. java selenium (十) 操作浏览器
  3. ASP.NET MVC 搭建简单网站 --1.前端页面布局和基本样式实现
  4. oracle 的服务器进程(PMON, SMON,CKPT,DBWn,LGWR,ARCn)
  5. TRIZ系列-创新原理-28-替代机械系统原理
  6. Centos7安装后出现please make your choice from &#39;1&#39; to e 解决方式
  7. 【网络流】POJ1273 Drainage Ditches
  8. 通过SVG与CSS3实现向上图标
  9. SQL SERVER 查询所有数据表名称和数据行数
  10. 2018-2019-2 20165234 《网络对抗技术》 Exp5 MSF基础应用
  11. PADS Layout VX.2.3 设置测量精度
  12. SoapUI之cookie设置
  13. 提升SQLite数据插入效率低、速度慢的方法
  14. PHP实现简单发红包(随机分配,平均分配)
  15. BZOJ1115[POI2009]石子游戏——阶梯Nim游戏
  16. PXC搭建
  17. PHP的几种输出方式
  18. 防止网站被镜像,被iframe
  19. Nexus 搭建maven 私有仓库
  20. Pragma: no-cache

热门文章

  1. 纯css背景图自适应
  2. elasticsearch命令
  3. 检测Android手机的IP地址
  4. html5的地理位置定位
  5. [z]重建索引
  6. MVC是架构模式,而不是设计模式
  7. c# 软件绑定网卡mac的实用
  8. hdu 5493 (2015合肥网赛) Queue
  9. (O)js核心:作用域链
  10. System.Runtime.InteropServices.COMException: 检索 COM 类工厂中 CLSID 为 {0002E510-0000-0000-C000-000000000046} 的组件时失败,原因是出现以下错误: 80040154