What command is used to find when a specific file was first introduced into the repository?
Posted by DavidLee
Last Updated: July 02, 2024
To find out when a specific file was first introduced into a Git repository, you can use the following command:
git log --diff-filter=A -- <file_path>
Here's what the options mean: - git log: Displays the commit history. - --diff-filter=A: Filters the commits to show only those where the specified file was added (i.e., "A" stands for added). - -- <file_path>: Specifies the path to the file you are interested in. This command will display the commit that introduced the specified file, along with details about that commit. You can find the date of that commit in the output. If the file was added in multiple commits, only the first introduction will be shown.