How to fast-forward a branch to head?

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 has no effect. This is because I have checkout an intermediate commit on master.

How to make master stay on head?


Try git merge origin/master. If you want to be sure that it only does a fast-forward, you can say git merge --ff-only origin/master.


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).