I'm trying to create a git alias to be able to call git resquash from foo branch (a child of master). The idea is to do a git rebase -i from the first commit in that branch without knowing the commit. Something is wrong though. I keep getting errors when trying it out.
Maybe my expansions are wrong? I'm using ZSH.
resquash = f() { CURRENTBRANCH=$(git symbolic-ref --short HEAD) ;\
COMMONCOMMIT=$(git merge-base ${CURRENTBRANCH} ${1-master}) ;\
git rebase -i $COMMONCOMMIT }; f
You can split the alias over multiple lines if it is a string with line continuation. That is, quote it (with double-quotes) and use backslash characters at the line end (don't forget to escape other double-quote characters):
[alias]
test = "!_(){ \
echo \"Hello\"; \
echo \"World\"; \
};_"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With