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

  • How to test code from a Git branch without merging it with master branch?
  • TFS 2017 Build Automatically kicks off and keeps failing
  • Branch does not exist
  • git diff filtered by file name
  • Capistrano stops at git:check
  • Android Studio Gradle Builds Slow After Project Added to Git
  • 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

    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


  • Equivalent of a git pre-merge hook?
  • How do I remove files saying “old mode 100755 new mode 100644” from unstaged changes in Git?
  • Git error Permission denied (publickey), couldn't paste publickey
  • Playframework 2 - Deploying to ec2
  • Branches have apparently diverged, but commit history is identical
  • Commit within a pre-push to update version
  • 2 Solutions collect form web for “git, how to I go back to origin master after pulling a branch”

    This should work to do what you need:

    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.


    Git Baby is a git and github fan, let's start git clone.