tig - a curses-based UI for git
tig
is pretty handy for exploring other branches and cherry-picking individual commits from other branches onto your current branch.
First, let's add a special keyboard alias for "cherry-pick with sign-off" to your user's .tigrc
file. Create ~/.tigrc
with the following content:
bind generic C !git cherry-pick -s %(commit) bind generic c !git cherry-pick %(commit)
Now, let's try cherry-picking a few commits from a different branch (cool-stuff) into your current branch.
tig cool-stuff
A list of the commits in cool-stuff will be displayed in reverse chronological order. The commits that are not found in your current branch should stick out:
2012-08-28 17:40 Dan Scott M─┐ [rel_2_3_mergery_tpac] [conifer/user/dbs/rel_2_3_mergery_tpac] Merge branch 2012-08-27 15:48 Dan Scott │ o Remove old version of style.css.tt2 2012-08-27 15:41 Dan Scott │ o Bump HRSRH up to 15px font size 2012-08-27 13:55 Dan Scott │ o Fix HSN link from topnav logo 2012-08-27 12:17 Dan Scott │ o Update HRSRH links and logos 2012-08-27 11:56 Dan Scott │ o University of Sudbury basic skin 2012-08-28 17:33 Dan Scott M─┐ Merge branch 'user/dbs/rel_2_3_mergery' of git.evergreen-ils.org:contrib/Conifer into rel_2_3_mergery_tpac 2012-08-28 17:03 Dan Scott │ o [rel_2_3_mergery] [conifer/user/dbs/rel_2_3_mergery] Use CSS selectors that new XUL can live with
You can move up and down the list of commits using standard VI keybindings (j
and k
) or the arrow keys.
Cherry-picking with sign-off
As you added the keybinding to .tigrc
, when you hit C
, then the commit in question will be cherry-picked with your sign-off from the branch you're browsing onto your current branch. You can do this for multiple commits in a single branch - a pretty easy way of avoiding those ugly merge commits, no?