'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,…
What it does
In the maker’s words, at launch
'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"
Does the same job
all alternatives →- GFGit–fiddle – Edit commit messages, author and timestamps during rebase2016 · github.com · ▲60

- RERebase-editor, a simple CLI app specifically for Git interactive rebase2017 · github.com · ▲62


- RI'rebaser' improves on 'git rebase -i'2015 · gist.github.com · ▲66
More dev tools this month
the category →



Open-source GTM skills for technical founders
Dev tools · 29d ago · gtmcofounder.com

OpenTrailPaper is open-source bike computer firmware for the LilyGO T5S3 4.7" E-Paper PRO. It supports offline maps, GPX routes, FIT recording and Bluetooth sensors.
Dev tools · 1d ago · opentrailpaper.com

Launched alongside, June 2015
the whole month →
Startup Launch List▲1,246Articles you need to read before launching a startup.
Growth · 2015 · startuplaunchlist.com

Get any site's company logo with just a URL
Dev tools · 2015 · clearbit.com



