views:

981

answers:

6

With subversion I could use tortieseSVN to view the history/log of a file.

How can I do this with git?

Just looking for history record for a particular file, and then the ability to compare the different versions.

+5  A: 

Looks like you want git diff and/or git log. Also check out gitk

gitk path/to/file
git diff path/to/file
git log path/to/file
docgnome
Thanks for gitk path/to/file
zzapper
+1  A: 

git-diff or git-log ?

vladikoff
+7  A: 

Use git log to view the commit history. Each commit has an associated revision specifier that is a hash key (e.g. 14b8d0982044b0c49f7a855e396206ee65c0e787 and b410ad4619d296f9d37f0db3d0ff5b9066838b39). To view the difference between two different commits, use git diff with the first few characters of the revision specifiers of both commits, like so:

# diff between commits 14b8... and b410...
git diff 14b8..b410
# only include diff of specified files
git diff 14b8..b410 path/to/file/a path/to/file/b

If you want to get an overview over all the differences that happened from commit to commit, use git log or git whatchanged with the patch option:

# include patch displays in the commit history
git log -p
git whatchanged -p
Christian
+1  A: 

you could also use tig for a nice, ncurses-based git repository browser. To view history of a file:

tig path/to/file
+3  A: 

All Git history browsers, including git log (and 'git log --graph'), gitk (in Tcl/Tk, part of Git), QGit (in Qt), tig (text mode interface to git, using ncurses), Giggle (in GTK+), TortoiseGit and git-cheetah support path limiting (e.g. gitk path/to/file).

Jakub Narębski
Can you point me how to set this up in TortoiseGit ?
Robert Vuković
+1  A: 

Of course, if you want something as close to TortoiseSVN as possible, you could just use TortoiseGit.

Jörg W Mittag