简体   繁体   中英

git, how to I go back to origin master after pulling a branch

This has to be a FAQ, but I can't find it googling.

Another person created a branch, commit'd to it, and pushed it to github using git push origin newbranch

I successfully pulled it down using

git pull origin newbranch

Now, I want to go back to the origin master version. Nothing I do seems to cause the files in the origin master to replace those in the newbranch.

git checkout master
git checkout origin master
git pull
git pull origin HEAD
etc

git pull origin master returns:

* branch            master     -> FETCH_HEAD
Already up-to-date.

This can't be hard, but I sure can't figure it out.

'git branch' returns

* master

and 'git branch -r' return

origin/HEAD
  origin/experimental
  origin/master

这应该可以满足您的需求:

git checkout origin/master

Next time, maybe you can use git fetch first, after that, use git merge.

This will make your operation more clear.

Br, Tim

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