Git is fixed in the main, does not appear when viewing the log of a specific file

We have a repository that has only a leading branch (for this discussion). Somehow we were in a situation where the developer combined his local host and pressed and was able to lose other commits.

The situation is that for several commits, if we run git log from the root of the project, it will display a commit. If we select one of these files and run the git log, it will not show the commit in the log. Changes in this fixation are also not reflected in the control of the head.

Does anyone have any ideas how this situation could happen and how we can stop it again?

+2
source share
2 answers

It looks like there may be changes to the files lost in the local merge performed by the developer, possibly when conflicts are resolved before the merge takes place.

You should try this command in the project root directory:

git log --stat -c 

See which files have been changed in each commit, and see if all of these changes are included in the merge.

+6
source

If you run

 $ git log file 

it displays all commits starting from the current branch (which may differ: the output of the "git branch" is displayed as one branch), but only those commits that have changes that affect this path. Even if you do not have any other branches, you can be on a stand-alone HEAD, that is, on an unnamed branch.

Also check "git show" or "git whatchanged" (or "git show master") if the files are really modified.
Use "git show -cc" or "git show -raw -abbrev" if you want to check merge commit.

For recovery you can use "git reflog" / "git log -g".

+2
source

All Articles