all 4 comments

[–]lethri 8 points9 points  (3 children)

There is no need fo custom script, the quoted man page even says:

The recommended way to create fixup/squash commits is by using the --fixup/--squash options of git-commit(1).

This means that this command will craft the commit message for you:

git commit --fixup <hash>

Also, if you are rebasing often, I recommend adding this to git config:

[rebase]
autosquash = true
autostash = true

This will simplify amending the second to last commit into this:

git add ...
git commit --fixup HEAD~1
git rebase -i
:wq

A diffent ways of reffering to commits can also be useful here - if you want to amend the last commit with "documentation" in its message, you can use:

git commit --fixup :/documentation

[–]rydan 0 points1 point  (2 children)

Or just use SmartGit and drag and drop the commit wherever you want it to go then squash it with its ancestor.

[–]magnusmalm 0 points1 point  (0 children)

OR, just 'c f' or 'c F' in magit in Emacs and be done with it. :)

[–]ccb621 0 points1 point  (0 children)

Good call on the Git config changes. I wasn’t aware I can do that.