Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git tree with selectable nodes in terminal?

Tags:

git

Emacs has an optional undo-tree. You can cursor to each node, and hit return to go back in time, even along branches.

Is there something similar for git, which can be accessed within the Terminal (not Emacs). So, within a git project, I could type a command and it would show the tree. I could cursor around, going back in time or even switching to another branch, then hit return and it would checkout that particular commit's whole state.

git undo tree

like image 785
cannyboy Avatar asked Feb 18 '13 12:02

cannyboy


People also ask

What is git branch command?

The git branch command lets you create, list, rename, and delete branches. It doesn't let you switch between branches or put a forked history back together again. For this reason, git branch is tightly integrated with the git checkout and git merge commands.


1 Answers

As @NevikRehnel said, tig is your friend.

tig --all shows you your complete log in a tree form (as git log's --graph switch).

tig log view

You move between commits with up and down keys, you see a git show of the selected commit with Enter, and you can hit Shift + C for doing git cherry-pick of that commit.

tig show view

You can press H anytime to see help.

tig help view

You can checkout branches, but you can too add custom bindings for doing git checkout.

I think man tigrc would be enough to understand how.

like image 146
mgarciaisaia Avatar answered Oct 30 '22 02:10

mgarciaisaia