Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Write a git alias for fast forward that works in any tracking branch?

Tags:

git

alias

I'd like to create an alias to do the following:

Working in master, I would like git ff to perform git merge --ff-only origin/master. But I want the same alias, when run in maint to perform git merge --ff-only origin/maint. Likewise for any other tracking branches. Is this possible?

like image 807
keithjgrant Avatar asked Feb 22 '11 20:02

keithjgrant


1 Answers

Kudos to the other two answers, but there's an easier way, assuming that your branches are tracking the remote branches:

git pull --ff-only

Bonus: this will work even if your branches are tracking branches in a repo other than origin, or tracking differently-named branches. Also it's really short.

like image 186
Cascabel Avatar answered Nov 14 '22 23:11

Cascabel