DEV Community

loading...

Discussion on: Don't Amend, Fix

Collapse
freeatnet profile image
Arseniy ✌️ Ivanov

Here are a few shortcuts in the same vein:
fixup with the default of HEAD:
fu = !bash -c 'git commit --fixup ${1:-HEAD}' -
Find the point of divergence of the current branch from another branch (default master), useful for the following trick:
diverges = !bash -c 'diff --old-line-format='' --new-line-format='' <(git rev-list --first-parent "${1:-master}") <(git rev-list --first-parent "${2:-HEAD}") | head -1' -
Finally, rebase with autosquash from the point of divergence from another branch (so that you don't have to count the commits):

ar = !bash -c 'git rebase --autosquash -i `git diverges ${1:-master}`'

Collapse
tmr232 profile image
Tamir Bahar Author

This is great, thanks!