Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

git

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
like image 365
fishtoprecords Avatar asked Mar 20 '12 23:03

fishtoprecords


2 Answers

This should work to do what you need:

git checkout origin/master
like image 118
ralphtheninja Avatar answered Oct 25 '22 19:10

ralphtheninja


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

This will make your operation more clear.

Br, Tim

like image 40
Tim Avatar answered Oct 25 '22 18:10

Tim