0

Is there a simple way to find out when (in which commit or merge) a file was added to a branch? Specially, from an experimental feature branch to master.

Clayton
  • 1,967
  • 4
  • 18
  • 26

2 Answers2

1

git log <branch> -- <file> should do the trick...

twalberg
  • 59,951
  • 11
  • 89
  • 84
0

You can use

git log --first-parent -- <file>

to list the commits along the main branch which have modified that file. The last one listed would be the commit where the file was introduced to the main branch.

This does depend on merges being done while on the main (e.g. master) branch to pull in change from the other branches, and not the other way around.

qqx
  • 18,947
  • 4
  • 64
  • 68