作者热门文章
- c - 在位数组中找到第一个零
- linux - Unix 显示有关匹配两种模式之一的文件的信息
- 正则表达式替换多个文件
- linux - 隐藏来自 xtrace 的命令
我已经 fork 了一个 git 仓库。如果源有更新, fork 的 repo 是否会自动更新?或者我应该在 cmd 中执行一些命令来更新这个 fork 的 repo 吗?这是什么命令?
最佳答案
他们在 github 文档上提供了关于此主题的非常具体的帮助:https://help.github.com/articles/fork-a-repo
Configure remotes
When a repo is cloned, it has a default remote called origin that points to your fork on GitHub, not the original repo it was forked from. To keep track of the original repo, you need to add another remote named upstream:
git remote add upstream https://github.com/octocat/Spoon-Knife.git
# Assigns the original repo to a remote called "upstream"
git fetch upstream
# Pulls in changes not present in your local repository,
# without modifying your files
Pull in upstream changes
If the original repo you forked your project from gets updated, you can add those updates to your fork by running the following code:
git fetch upstream
# Fetches any new changes from the original repo
git merge upstream/master
# Merges any changes fetched into your working files
关于git - 如何更新 fork 的 git 仓库?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11875723/
我是一名优秀的程序员,十分优秀!