如何更新 Git 克隆
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/10815203/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to update Git clone
提问by Josh Randall
I have started using Git. I have cloned the repo on my local system. I make the changes on the local machine and use git push
to the update the remote repo. It works fine.
我已经开始使用 Git。我已经在我的本地系统上克隆了 repo。我在本地机器上进行更改并用于git push
更新远程存储库。它工作正常。
I have a quick query how to update my clone from the remote. I tried git remote update
. It did not work, new changes does not appear. I just want to make sure I have recent copy of the repo before I get to work. How I can update the clone?
我有一个快速查询如何从远程更新我的克隆。我试过了git remote update
。它不起作用,没有出现新的变化。我只是想确保在我开始工作之前我有最近的 repo 副本。我如何更新克隆?
回答by Gilles Quenot
If you want to fetch + merge, run
如果要获取 + 合并,请运行
git pull
if you want simply to fetch :
如果您只想获取:
git fetch
回答by Syd Pao
git pull origin master
this will sync your master to the central repo and if new branches are pushed to the central repo it will also update your clone copy.
这会将您的 master 同步到中央仓库,如果新分支被推送到中央仓库,它也会更新您的克隆副本。