# how to track changes of a file

4 messages from 2008-06-16 to 2008-06-16. Participants: bill lam, Johannes Sixt.
Thread: https://gitlist.dev/t/13976

## bill lam, 2008-06-16 10:46

Subject: how to track changes of a file
Message-ID: <48564499.3050008@gmail.com>
URL: https://gitlist.dev/e/48564499.3050008%40gmail.com

```
I want to see what had been done to a particular file, so I started with the log,

$ git-log --no-color glinvc03.ijs |grep commit |head -3
commit 23335cf4acadb9f09410f106adbcc2b190fe9c70
commit 31e4f2c519caa9afa2e29ed8ffb40deb62aa972f
commit b515f020d05f2967a7283751c8dd3740de7136a4

I want to know how to,
1. cat the content this file for these 3 versions
2. show the differences between versions,

I use vim to view man page, and git-log without redirection will invoke vim as a 
man viewer.  Does git-log always use man?  Without the --no-color option there 
will be some "33m" prepending to some lines, is there any global setting to turn 
off color in git-log?

regards,

```

## Johannes Sixt, 2008-06-16 10:56

Subject: Re: how to track changes of a file
Message-ID: <485646F9.1030300@viscovery.net>
URL: https://gitlist.dev/e/485646F9.1030300%40viscovery.net
In-Reply-To: <48564499.3050008@gmail.com>

```
bill lam schrieb:
> I want to see what had been done to a particular file, so I started with
> the log,
> 
> $ git-log --no-color glinvc03.ijs |grep commit |head -3
> commit 23335cf4acadb9f09410f106adbcc2b190fe9c70
> commit 31e4f2c519caa9afa2e29ed8ffb40deb62aa972f
> commit b515f020d05f2967a7283751c8dd3740de7136a4

All you neede here probably was just

$ git rev-list -3 -- glinvc03.ijs

> I want to know how to,
> 1. cat the content this file for these 3 versions

$ git show {23335c,31e4f2,b515f0}:glinvc03.ijs

> 2. show the differences between versions,

$ git log -p -2 -- glinvc03.ijs

> I use vim to view man page, and git-log without redirection will invoke
> vim as a man viewer.  Does git-log always use man?  Without the
> --no-color option there will be some "33m" prepending to some lines, is
> there any global setting to turn off color in git-log?

You have set PAGER=vim in your .profile? Then put

GIT_PAGER=less; export GIT_PAGER

there, too.

-- Hannes

```

## bill lam, 2008-06-16 15:49

Subject: Re: how to track changes of a file
Message-ID: <48568B76.5050108@gmail.com>
URL: https://gitlist.dev/e/48568B76.5050108%40gmail.com
In-Reply-To: <485646F9.1030300@viscovery.net>

```
Johannes Sixt wrote:
> $ git rev-list -3 -- glinvc03.ijs
> 
> 
> $ git show {23335c,31e4f2,b515f0}:glinvc03.ijs

Thank for you help, but these 2 command did not work, did I missing something? I 
I use git version 1.5.4.3 on linux.

$ git rev-list -3 -- glinvc03.ijs
usage: git-rev-list [OPTION] <commit-id>... [ -- paths... ]
   limiting output:
     --max-count=nr
     --max-age=epoch
     --min-age=epoch
     --sparse
     --no-merges
     --remove-empty
     --all
     --stdin
     --quiet
   ordering output:
     --topo-order
...


$ git show {23335c,31e4f2,b515f0}:glinvc03.ijs
fatal: ambiguous argument '23335c:glinvc03.ijs': unknown revision or path not in 
the working tree.
Use '--' to separate paths from revisions

```

## Johannes Sixt, 2008-06-16 16:08

Subject: Re: how to track changes of a file
Message-ID: <48569003.6080406@viscovery.net>
URL: https://gitlist.dev/e/48569003.6080406%40viscovery.net
In-Reply-To: <48568B76.5050108@gmail.com>

```
bill lam schrieb:
> Johannes Sixt wrote:
>> $ git rev-list -3 -- glinvc03.ijs
>>
>>
>> $ git show {23335c,31e4f2,b515f0}:glinvc03.ijs
> 
> Thank for you help, but these 2 command did not work, did I missing
> something? I I use git version 1.5.4.3 on linux.
> 
> $ git rev-list -3 -- glinvc03.ijs
> usage: git-rev-list [OPTION] <commit-id>... [ -- paths... ]

Sorry, should have been

$ git rev-list -3 HEAD -- glinvc03.ijs

But this is not intended for daily use anyway. You are better off using
git log family of commands. Eg. if you insist on a 1-commit-per-line
listing, you'd use

$ git log -3 --pretty=oneline -- glinvc03.ijs

> $ git show {23335c,31e4f2,b515f0}:glinvc03.ijs
> fatal: ambiguous argument '23335c:glinvc03.ijs': unknown revision or
> path not in the working tree.
> Use '--' to separate paths from revisions

My guess is that glinvc03.ijs lives in a subdirectory of your repo. Then
you must supply the complete path from the repository root:

$ git show {23335c,31e4f2,b515f0}:some/subdir/glinvc03.ijs

(No, this will not be changed.)

-- Hannes

```
