'g

'git inject' – amend commits other than HEAD

Hacker News

'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 card

Actual performance

71points
36comments
Made the leaderboard

Launch Intel predictions

Analyze your own launch →
Product HuntOn track for Day 1 leaderboard · Strong signals: using, code · Missing: mac, agents, macos
78%78% predicted probability of success on Product Hunt, based on ML models trained on real launch data.
best fitHighest predicted score across all platforms for this description.
Hacker NewsStrong engagement from HN community · Strong signals: io · Missing: https docs, excited, just released
52%52% predicted probability of success on Hacker News, based on ML models trained on real launch data.
nativeThis product was originally launched on this platform.
Indie HackersIH features products with proven revenue · Missing: supports, reddit linkedin, podcasting
46%46% predicted probability of success on Indie Hackers, based on ML models trained on real launch data.
AppSumoMay struggle as an AppSumo deal · Missing: plus, platform, intuitive
45%45% predicted probability of success on AppSumo, based on ML models trained on real launch data.
TrustMRRLess likely to generate early MRR · Strong signals: way · Missing: mobile apps, ios, personal
39%39% predicted probability of success on TrustMRR, based on ML models trained on real launch data.
Acquire.comPre-revenue stage for this audience · Strong signals: active · Missing: arr, mrr, revenue
18%18% predicted probability of success on Acquire.com, based on ML models trained on real launch data.
BetaListMay not resonate with beta-testers · Missing: web3, chat, crypto
6%6% predicted probability of success on BetaList, based on ML models trained on real launch data.

Correct prediction on native model

Similar products

Ge
Geotag your git commits38%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

Geotag your git commits

Hacker News2
Gi
Git Searcher, search commits for an added or removed string55%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

Git Searcher, search commits for an added or removed string

Hacker News3
an
an Amsterdam Metro map in git commits42%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

an Amsterdam Metro map in git commits

Hacker News2
'g
'git branch --merged' that works with rebased commits37%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

'git branch --merged' that works with rebased commits

Hacker News2
'g
'git branch --merged' that works with rebased commits37%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

'git branch --merged' that works with rebased commits

Hacker News1
Gi
GitGallery – Turn your Git commits into NFTs Just launched on Rinkeby45%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

GitGallery – Turn your Git commits into NFTs Just launched on Rinkeby

Hacker News2
In
Interactively split your Git commits56%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

Interactively split your Git commits

Hacker News1
Ge
Geotag Git Commits Using Unix Tools46%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

Geotag Git Commits Using Unix Tools

Hacker News2
Gi
Git Emoji Commits40%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

Git Emoji Commits

Hacker News2
80
8000 commits later......34%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

8000 commits later......

Hacker News1