'git inject' – amend commits other than HEAD
'git inject' – amend commits other than HEAD
'git inject' is a git alias (see code at the bottom). It is similar to 'git commit --amend', but it allows you to 'inject' your changes into commits further back in history (using 'rebase'). If you're as pedantic as I am about the git history you're about to push into master (as far as I can control it, I strive to keep each commit conceptually coherent), you'll often come to a situation where you have a modification that really belongs in an older commit. It takes a few git commands to stash other changes away, commit the modification, then interactively rebase over some previous commit, move your commit into place, change to 'fixup', save, exit, and then unstash whatever else you had lying around. Not fun. Here's how 'git inject' makes it fun: >> git inject <commit-ref> <patch-ref> >> git inject HEAD^^ -a # inject all work-dir modifications >> git inject a28kd8 -p # interactively select patches to inject >> git inject HEAD~4 file1 # inject the modifications in file1 Just put this into your .gitconfig under 'aliases': inject = "!f() { set -e; HASH=`git show $1 --pretty=format:\"%H\" -q`; shift; git commit -m \"fixup! $HASH\" $*; [ -n \"$(git diff-files)\" ] && git stash && DIRTY=1; git rebase $HASH^^ -i --autosquash; [ -n \"$DIRTY\" ] && git stash pop;}; f"
Share cardActual performance
Launch Intel predictions
Analyze your own launch →Correct prediction on native model
Similar products
Geotag your git commits
Git Searcher, search commits for an added or removed string
an Amsterdam Metro map in git commits
'git branch --merged' that works with rebased commits
'git branch --merged' that works with rebased commits
GitGallery – Turn your Git commits into NFTs Just launched on Rinkeby
Interactively split your Git commits
Geotag Git Commits Using Unix Tools
Git Emoji Commits
8000 commits later......