8

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

mgarciaisaia
  • 14,521
  • 8
  • 57
  • 81
cannyboy
  • 24,180
  • 40
  • 146
  • 252
  • 1
    This isn't a duplicate because it's a view only, but it may lead you somewhere useful: http://stackoverflow.com/questions/1838873/visualizing-branch-topology-in-git – John Zwinck Feb 18 '13 at 13:03
  • yeah, seen those kinda things, but was wondering if there is a selectable version – cannyboy Feb 18 '13 at 13:16
  • 6
    `tig` might be interesting for you, which is kinda like `gitk` with an ncurses UI – Nevik Rehnel Feb 18 '13 at 14:35

2 Answers2

11

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.

mgarciaisaia
  • 14,521
  • 8
  • 57
  • 81
  • I wasn't aware of `tig`, thanks for sharing. Seems like a great tool. N.B. those running OSX can install it using [homebrew](http://mxcl.github.com/homebrew/) (`brew install tig`). – ben.snape Feb 26 '13 at 09:37
0

For a graphical view of the git, install gitk utility, and type gitk --all and right click to change the head position. Use can use soft reset or hard reset. Caution: hard reset will loose all the changes made after the head to which you are resetting.

user1596193
  • 100
  • 3