Is there a hook script available somewhere that would do a fast-forward merge on branch switch? I have a repository where there are multiple branches, and I have to work on several on them. After a git pull which obviously merges the currently checked out branch it often happens to me that I see the following message when switching branches:
> git checkout master
Switched to branch 'master'
Your branch is behind 'origin/master' by 10 commits, and can be fast-forwarded.
>
I would like git to do that fast-forward merge for me automatically on branch change. I don't want it to unconditionally merge but only when a fast-forward is possible.
Thanks in advance for suggestions,
Rhonda
I would suggest an alias rather than a hook, in oder to combine:
git pull
The question "Using Git when I want my branches to be always updated" references the script "git-fetch-and-fast-forward-all-branches.sh
", which can be of interest here.