sh 如何从原始存储库获取新的更改

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了sh 如何从原始存储库获取新的更改相关的知识,希望对你有一定的参考价值。

# Make sure you have 2 origins (your forked project and project from which you forked)
$ git remote -v 
  #  origin	git@github.com:a-LERT/schoolTest.git (fetch)
  #  origin	git@github.com:a-LERT/schoolTest.git (push)
  #  upstream	git@github.com:begin29/schoolTest.git (fetch)
  #  upstream	git@github.com:begin29/schoolTest.git (push)
  
# If you have only one add it
$ git remote add upstream git@github.com:begin29/schoolTest.git

# fetch fresh changes
$ git fetch upstream master
# merge it to forked repository
$ git checkout master
$ git merge upstream/master

# checkout to own feature branch and rebase(merge) new changes to it
$ git checkout my-feature
$ git rebase master

$git log
#now you will see your changes with fresh changes from repository which you forked


# if you will get conflicts after rebase
# fix conflicts and add it to git status
$ git add file1 file2 # or `git add .`
$ git rebase --continue
# it will merge your and other commits with resolved conflicts

# if something went wrong you within rebase process
# you can abort rebase
$ git rebase --abort
# you will have sate before rebase

以上是关于sh 如何从原始存储库获取新的更改的主要内容,如果未能解决你的问题,请参考以下文章

如何使用命令行从私有 github 存储库下载单个原始文件?

sh 使用cURL从命令行创建新的Github存储库

如何将分支内容移动到另一个存储库保留历史记录并避免复制原始存储库的完整历史记录?

如何更改 gradle 插件存储库?

sh 如何将新的本地分支推送到远程Git存储库并跟踪它?

我可以使分叉的 github 存储库从原始版本中保持最新吗? [复制]