I'm trying to create a git alias that merges the currently checked out branch into the master branch. Specifically I'd want to quickly get my master branch get up to speed with what I'm working on. I've got the following:
[alias]
co = checkout
ff = !git co master && git merge work && git co work
However I'd like the alias to know which branch it was on and get back to it. I tried adding $1
but unfortunately I get a error on the last checkout in the alias:
# with
[alias]
co = checkout
ff = !git co master && git merge $1 && git co $1
> git ff work
Switched to branch 'master'
Already up-to-date.
error: pathspec 'work' did not match any file(s) known to git.
Anyone knows why it does this? (I'm on a Mac by the way)