When running git commit --fixup=beefca7e
or when referencing a previous commit in a commit message, I have to use the mouse in a clumsy workflow. I use bash:
- Open a new terminal tab/window/pane.
git log --oneline --graph
.¹- Scan through the list to find the relevant commit sha.
- Grab the mouse, select the sha, copy it to the clipboard.²
- Move back the the pane where I was working and paste it there.
This works. But I suspect this can be done much easier.
Are there commandline tools, scripts or git-addons out there that allow me to quickly filter through the commits and copy the sha of a selected entry? Is my workflow wrong(or naive), and did I miss an important git-feature somewhere?
Bonus for being able to use this in vim too, since that is my editor to edit commit messages. Bonus for copying the short sha instead of the full one.
- ¹ I have a somewhat more complex alias for this named
git lg
. - ² xclip/gnome/clipboard manager is configured to auto-copy-on-select. Otherwise ctrl-c/cmd-c or so. Pasting is middle-mouse-button. Saves a few commands but still suboptimal. I'd rather not use the mouse at all and omit most steps.