Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Step through a file's history in git; similar to p4v timelapse

Tags:

git

I'm seeking a tool to help when probing a file's history. Specifically, I want to view the entire contents of the file, but be able to step backward and forward in time. Extra joy for decorations indicating the diff from previous rev or some other specified rev.

Currently I use git blame, and can see what changes impacted each current line. Then I have to relaunch a viewer for that file with some particular commit. It's labor intensive, and if a tool already automates this I'd love to use it!

Perforce's timelapse view is the best tool to date I've seen for this task.

like image 210
Vincent Scheib Avatar asked Oct 05 '11 20:10

Vincent Scheib


4 Answers

gitk -- filename should do what you want, if you kick up the lines of context in the middle, and scroll up and down through the revisions.

like image 110
Karl Bielefeldt Avatar answered Nov 02 '22 03:11

Karl Bielefeldt


Tig, a text mode interface for git, offers a blame view that offers some of this functionality:

  • Step backwards in time to the commit of a given line (b key).
  • Step backwards to the parent commit of a given line (, key).
  • Returning forwards in time to a view you were at previously (< key).

It does not preserve the viewing location when stepping to a parent commit (it seems to when using the line's commit).

like image 32
Vincent Scheib Avatar answered Nov 02 '22 01:11

Vincent Scheib


Here is a Git Time-Lapse View tool that I have written in Java:

https://github.com/JonathanAquino/git-time-lapse-view

enter image description here

like image 11
Jonathan Aquino Avatar answered Nov 02 '22 02:11

Jonathan Aquino


git gui blame is an option, although it's not as good.

Example for gc_storage from Ansible:

git gui blame --line=155 library/cloud/gc_storage

git gui blame --line=155 library/cloud/gc_storage

Right click a line and select Blame Parent Commit to move back in time, returning to more recent changes with the view history arrow in the top left.

like image 8
Cristian Ciupitu Avatar answered Nov 02 '22 02:11

Cristian Ciupitu