Skip to content
Advertisement

Show mtime of a file in another branch

Using git ls-files --debug or stat command, you can see the mtime (last modified time) of a file in a current branch (strictly in a current commit).

JavaScript
JavaScript

Then is there any way to see this information for the same file in another branch (another commit)?


Workarounds

Currently I have two workarounds, both of which I don’t think are beautiful solutions.

  • First git checkout <commit> and then git ls-files --debug <file>.

  • First git blame <commit> <file>. The output includes many timestamps. Parsing them, pick the latest timestamp (using cut, sort, sed, etc.).

Advertisement

Answer

You can get modification time in another branch with :

JavaScript
User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement