1

We are using JIRA and Github together. Now we found out some code we can see in the JIRA tickets has already been pushed to Github at sometime before, and we can click on link, it goes to Github and we can see the changes we made there. But all the code are not in our current branches. And even I go to the local projects to find the file, right click -> show log (tortoiseGit), that ticket and push record is not in the log... I switched to all the branches try to find that record, but I just can't find it anywhere.

I have the commit hash, I checkout the code with that hash, I can see the changes are back, but it is just not in any of our current branches. I don't know what happened, did anyone got this issue before, how can I get all these code back to the current branches...

Tech Noob
  • 522
  • 1
  • 8
  • 24

2 Answers2

3

You can simplify your search:

git branch --remote --contains <commit-id>

(See How to list branches that contain a given commit?)

To get those changes, you can merge that commit into a working branch (git merge <commit-id>).

As VonC suggests, rebases or forced deletion are the most likely causes.

Community
  • 1
  • 1
Joe
  • 23,380
  • 9
  • 61
  • 75
0

It can happen when:

  • you rebase a branch, which rewrites all the sha1 (you keep the old sha1 in your reflogs)
  • you delete a branch (and push the deletion of that branch)
  • you merge --squash a branch in (for instance) master, and then delete that branch locally

If you can locally checkout with that SHA1, at least you can create a local branch starting from said SHA1, and push it back.

Community
  • 1
  • 1
VonC
  • 1,042,979
  • 435
  • 3,649
  • 4,283
  • Not only I can locally checkout that, but the other people can also see that on the github and they can checkout the code, too. – Tech Noob Oct 06 '13 at 13:47