I'm trying to create an alias for my "merge to staging" workflow.
Let's say I've finished a task in branch "dev/layout_fix" and want to deploy it to staging after commiting.
This is my way:
git checkout staging
git merge dev/layout_fix --no-ff
git push
git checkout dev/layout_fix
Now I've tried this approach:
[alias]
branch-name = "!git rev-parse --abbrev-ref HEAD"
stagify = "!git checkout staging && git merge $(git branch-name) --no-ff && git push && git checkout $(git branch-name)"
but the alias branch-name is "staging" because of the checkout.
Is it possible to write the current branch name in a variable before staging is checked out?