Our great sponsors
-
InfluxDB
Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.
If you're an Emacs user, I must recommend magit (https://magit.vc/) - the interactive rebasing (including squashing/fixups) is one of the best UIs (overall, not just git) I've seen in my life.
I'd switch away from Emacs but magit keeps me hooked!
How does Vim's fugitive (https://github.com/tpope/vim-fugitive/) plugin compare to this, in case anyone here has used them both? I've only used it for some basic things so far, and it seems nice enough, but I'm wondering if it's good with more advanced git-fu like the above.
I wrote my own tool for this which allows you to fix up a file based on the last time you changed that file, or on a specific commit. It will then execute an interactive rebase to that point as well as taking care of stashing and then restoring unrelated files.
https://github.com/alblue/scripts/blob/master/git-fixup
I like the idea of having the editor definition return “true” instead of showing it; I’ll have to add that later.
If you start doing a commit (via `c` in the magit status buffer, with the standard semantics of "you're going to commit everything that's currently staged") you can press capital F for an instant fixup, or capital S for instant squash.
When you press either of those, magit pops up a commit picker which shows the current git log. Selecting a commit will then instantaneously apply your staged changes to the selected commit. It's much simpler than any of the other workflows I've seen in response to your question.
The gif in this repo (for a tool I made that simulates this behavior as a cli tool for some jealous coworkers) tries to show the workflow: https://github.com/quodlibetor/git-fixup
git-autofixup can also be installed by simply downloading the script[1], giving it execute permissions, and putting it somewhere in your PATH. It needs perl 5.8.4+, which is very old, and only depends on the standard library. Git ships with a Perl interpreter on Windows.
If there are any staged changes, git-autofixup only fixes those up and ignores any unstaged ones; otherwise it tries to autofixup all unstaged changes.
[1]: https://github.com/torbiak/git-autofixup/blob/master/git-aut...