How to fast-forward a branch to head

Issue

I switched to master after developing on a branch for a long time. The log shows:

Your branch is behind ‘origin/master’ by 167 commits, and can be fast-forwarded.

I tried:

git checkout HEAD

It doesn’t have any effect. This is because I have checked out an intermediate commit on master.

How can I make master stay on head?

Solution

Doing:

git checkout master
git pull origin

will fetch and merge the origin/master branch (you may just say git pull as origin is the default).

Answered By – Greg Hewgill

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published