简体   繁体   中英

What is the best way to update a forked git repo/branch to have the latest upstream master?

The idea is that my local master is out of date from the upstream/master and I just want to get the latest changes from upstream in the most efficient way possible. I've asked around and gotten a few different answers, some of which have been:

git merge upstream/master
git merge --ff-only upstream/master
git branch -f master upstream/master
git rebase upstream/master master

I'm currently using git merge --ff-only , but I'm not fully aware of the pros/cons of the alternatives.

There was some clarification requested regarding forks: Yes, this is a fork where upstream is the work of others and origin is my fork. I want to update master (locally and eventually at origin) to be the same as upstream/master.

git pull origin master是我通常使用的

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM