There have been multiple accounts created with the sole purpose of posting advertisement posts or replies containing unsolicited advertising.

Accounts which solely post advertisements, or persistently post them may be terminated.

jks ,

Not exactly an alias but a short script. First, get git-revise which is a replacement for git rebase, and fzf if for some reason you don’t have it yet. Then make a script in your ~/.local/bin called git-f or whatever you’d like:

<pre style="background-color:#ffffff;">
<span style="font-style:italic;color:#969896;">#!/bin/bash
</span><span style="color:#323232;">REF</span><span style="font-weight:bold;color:#a71d5d;">=</span><span style="color:#183691;">${</span><span style="color:#323232;">1</span><span style="font-weight:bold;color:#a71d5d;">:-</span><span style="color:#183691;">origin/main}  </span><span style="font-style:italic;color:#969896;"># adjust to your favorite trunk branch name
</span><span style="color:#323232;">COMMIT</span><span style="font-weight:bold;color:#a71d5d;">=</span><span style="color:#183691;">$(</span><span style="color:#323232;">git</span><span style="color:#183691;"> log</span><span style="color:#323232;"> --pretty</span><span style="font-weight:bold;color:#a71d5d;">=</span><span style="color:#183691;">oneline ${</span><span style="color:#323232;">REF</span><span style="color:#183691;">}.. 
</span><span style="color:#183691;">         </span><span style="font-weight:bold;color:#a71d5d;">| </span><span style="color:#323232;">fzf --preview </span><span style="color:#183691;">"git show -p --stat {+1}" </span><span style="font-weight:bold;color:#a71d5d;">| </span><span style="color:#323232;">cut -d</span><span style="color:#183691;">' '</span><span style="color:#323232;"> -f1</span><span style="color:#183691;">)
</span><span style="font-weight:bold;color:#a71d5d;">if </span><span style="color:#62a35c;">[ </span><span style="color:#323232;">-n </span><span style="color:#183691;">"$</span><span style="color:#323232;">COMMIT</span><span style="color:#183691;">" </span><span style="color:#62a35c;">]</span><span style="font-weight:bold;color:#a71d5d;">; then
</span><span style="color:#323232;">    </span><span style="color:#62a35c;">exec</span><span style="color:#323232;"> git revise </span><span style="color:#183691;">"$</span><span style="color:#323232;">COMMIT</span><span style="color:#183691;">"
</span><span style="font-weight:bold;color:#a71d5d;">else
</span><span style="color:#323232;">    </span><span style="color:#62a35c;">exit</span><span style="color:#323232;"> 1
</span><span style="font-weight:bold;color:#a71d5d;">fi
</span>

Now hack away in a branch, make some commits, and at some point you will realize you want to modify an earlier commit. Use git add -p to add the relevant lines, but then instead of making a fixup commit just type git f and pick the target commit from the list.

  • All
  • Subscribed
  • Moderated
  • Favorites
  • [email protected]
  • random
  • lifeLocal
  • goranko
  • All magazines