top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

How to show the commit history of a file in Git

0 votes
944 views

I want to retrieve the commit history of a given file.What command should I issue? I expect the command like below.

D:GitTest> git show --commit-history test.txt
8194aaa
c419234
...
posted Jul 11, 2013 by anonymous

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

+1 vote

git log --follow --format=%H test.txt

As Git does not explicitly track renaming and copying of files, you might want to read up the git log manual on the "--find-renames", "--find-copies" and "--find-copies-harder" command-line options, if you
find the defaults for Git's heuristics of sensing file's lifetime are not sufficient to uncover the file's past life.

answer Jul 11, 2013 by anonymous
Similar Questions
0 votes

I want to show commit related information by the command below.By this, committed files are shown, but names only, off course.But in addition to this, I want to show commit file types (New, Edited, and Deleted).What argument should I use in the command?
git --no-pager show --format=%h%n%an%n%ai%n%s --name-only

+2 votes

I'm working on a project that used to use a proprietary CM system (aka oldCM). At a point in time, the state of the code was frozen and used as the basis for commits in SVN.

What I would like to to do is take the individal commits from the oldCM and place them into git knowing that the time/date stamps won't match. Then I want to do whatever is necessary to setup git so that I can run "svn rebase" to pull in the commits from the SVN repository.

What is the easy way to do this?

+1 vote

When run that command immediate after "git bisect start" somebody sees the full commit range as defined in "git bisect start".

However running that command later after few git bisect steps" somebody is just presented with the remaining commit interval. Is this intended ?

+2 votes

How can I add a file later to a commit? I created a new branch and submitted a commit with 2 files.

I observed, that one more file should have been submitted with this commit, so I would like to add a file to an earlier commit.

Any solution for this?

+2 votes

As you know, I can checkout the Nth checked out branch via this syntax:

$ git checkout @{-N}

Is there a built-in mechanism to get a listing of previously checked out refs? Basically, this would be similar to 'history' command in linux where instead of actual commands, it lists like this:

HEAD@{-1}: master
HEAD@{-2}: topic1
HEAD@{-3}: 3f346e9 (detached)

Seems like reflog should be able to do this, and maybe it can, but I'm not sure. Any tips? I'd be fine making a convenient alias for this if it ends up being a series of piped commands.

...