Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

View all revision numbers that made changes to a particular file in Mercurial

Tags:

git

mercurial

I would like to see all revision numbers that made any changes to a particular file. The output should look like follows:

20
27
59

If it is not possible, is it possible with Git?

Thank you.

like image 407
Valentin V Avatar asked Nov 17 '25 00:11

Valentin V


2 Answers

Use the template system in Mercurial. To get the revision number for the file README you'll do:

hg log --template '{rev}\n' README

If you need the changeset hashes instead, then it's:

hg log --template '{node|short}\n' README

See hg help templating for more help. You can find the same help online (search for "Template Usage").

like image 199
Martin Geisler Avatar answered Nov 19 '25 14:11

Martin Geisler


With git, you can run

git rev-list HEAD -- path/to/file

and you'll see a list of the commits which changed that file. Note that you can also run for example

gitk --all path/to/file

to open gitk, only showing commits for that file

like image 37
Gareth Avatar answered Nov 19 '25 14:11

Gareth