Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Query git reflog for all commits to a specific file

Tags:

git

reflog

Is it possible to check the git reflog for all commits to a specific file.

I made a commit to file foo.txt and now it no longer shows in the git history via

git log foo.txt 

I want to search the reflog to find all commits to this file so I can find my "lost" commit.

like image 279
cpjolicoeur Avatar asked Jun 10 '11 19:06

cpjolicoeur


People also ask

How do you find all commits to a file in git?

Use git log --all <filename> to view the commits influencing <filename> in all branches.

How do I see git Reflog?

git reflog directories can be found at . git/logs/refs/heads/. , . git/logs/HEAD , and also . git/logs/refs/stash if the git stash has been used on the repo.

What is git Reflog command?

Reference logs, or "reflogs", record when the tips of branches and other references were updated in the local repository. Reflogs are useful in various Git commands, to specify the old value of a reference. For example, HEAD@{2} means "where HEAD used to be two moves ago", master@{one.

Does git push Reflog?

Answer is no. Anonymous objects--objects that are only referenced by your reflog--are private to the local repo.


1 Answers

Came across this while searching for an answer, which is simple: git reflog -- $PATH, which will include amends and other actions that will not be visible otherwise (though beware, reflog will be pruned by gc)

like image 135
Arkadiy Kukarkin Avatar answered Oct 18 '22 14:10

Arkadiy Kukarkin