M
M
MasterCopipaster2021-11-18 06:30:49
git
MasterCopipaster, 2021-11-18 06:30:49

How to find the branch or commit in git in which the file was first created?

How to find the branch or commit in git in which the file was first created?
bash or sh shell. While working on the project, someone dropped my code. I can’t remember which thread it was in, I remember that it was 4 months old. back and remember the name of the file that was exactly at the first commit.
The file name corresponds to the regular expression /(ToModel|ToModels).php/m How to find in which commit or branch this file was created? (or at least just a list of kamits where it still exists)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey Kuznetsov, 2021-11-18
@MasterCopipaster

Browsing history
If you specify a directory or filename, you will limit the output to only those commits that have changed those files. This option is always listed last after a double dash (--) to separate paths from options:

git log --name-status --graph --oneline --since=4.months -- ToModel*.php

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question