1

There is a particular commit hash that I am interested in:

git show 868cd84a941 --name-status

This command shows that the commit modified the file:

M       src/web/thirdParty/jquery/jquery.js

When I run the command:

git branch --contains 868cd84a941

One of the branch names returned is '2018_06'

However, when I have the 2018_06 branch checked out, and I view the file history via the command:

git log --graph --oneline --decorate -- src/web/thirdParty/jquery/jquery.js

It only shows one line of history:

* a7ef0eab25f Add 'src/web/thirdParty/' from commit '5a733590a44a84cafb17afa8d8f7379a5ee2cd0e'

Which is not the commit I am interested in. Why do I not see this commit in this file's history if that commit was made or merged into this branch?

Looking through the history it appears that, at some point, a commit was made that claims to have merged the branch containing the original commit into the main branch. However, it seems that this merge commit was made without actually merging any changes from the branch in.

  • 1
    possible duplicates: https://stackoverflow.com/q/38604851/1256452, https://stackoverflow.com/q/48814114/1256452, https://stackoverflow.com/q/21464421/1256452 – torek May 21 '18 at 20:54
  • 1
    Thanks @torek, I got the answer I needed from https://stackoverflow.com/questions/48814114/git-history-for-branch-after-merge. So, the git log command I used was hiding two commits (first one commit to update the file, then another commit reverting the previous commit) because the end result was the same. – Travis Bruce May 21 '18 at 21:22

1 Answers1

0

Since I couldn't neither figure out an acceptable answer, I tried to look for the (apparently automatic) commit message inside the source code repository of Git itself with :

git grep 'Add .* from commit'

and I found this :

contrib/subtree/git-subtree.sh:         commit_message="Add '$dir/' from commit '$latest_new'"
contrib/subtree/t/t7900-subtree.sh:             check_equal "$(last_commit_message)" "Add '\''sub dir/'\'' from commit '\''$(git rev-parse FETCH_HEAD)'\''"

It seems that your repository is divided into multiple subtrees, which might have separate histories.

Obsidian
  • 3,719
  • 8
  • 17
  • 30
  • I think this is true for when the file was originally added. However, the branch that the commit exists in (i.e. I can see the commit in the file history), does exist in this same Git repository. So I would expect it would have been a normal merge into the main branch. – Travis Bruce May 21 '18 at 21:06