user1899082
user1899082

Reputation:

Viewing long list of my commits to a branch

I have created a Master branch like this:

git branch -u MyMasterBranch origin/MyMasterBranch

and I have created other branches from that like this:

git checkout MyMasterBranch
git checkout -b myJIRAbranch-1

and have worked on those smaller myJIRAbranch-1 branches and have merged them at the end to the MyMasterBranch with git merge --squashmyJIRAbranch-1

Now I want to find the git commit numbers for those merges that I have done from my JIRA branches into my MyMasterBranch ?

What's a good command to do that? that gives me a clean and nice report?

Upvotes: 0

Views: 139

Answers (2)

krlmlr
krlmlr

Reputation: 25484

As Chronial noted, the information about individual commits is not retrievable directly, unless you supplied the --log switch when saying git merge --squash. In the latter case, you might see SHA1 hashes of the individual commits in the squashed commit messages, and should be able to retrieve the commits using these hashes.

If not, we may consider the original branches lost. A few questions on this site already address this problem:

To sum up, git reflog and git log -g are your friends. All solutions presume that you still have access to your development repository (where the individual commits are located) and that the commits are not "too old" (otherwise git gc might have cleaned them irrevocably).

Upvotes: 2

Chronial
Chronial

Reputation: 70833

I don’t think that is possible. You told git to lie about the merges, and that it did. Git does not store any information about merging if you use --squash.

Finding you merge commits is basically impossible now. You could write a script that does some guessing – get every diff in master and try to find the same changes in jira. That will obviously not produce reliable results, but is the best I can think of. There is no built-in git command to do that.

Upvotes: 1

Related Questions