Guest User

Untitled

a guest
Mar 24th, 2018
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.82 KB | None | 0 0
  1. If you have a branch like this
  2. Master
  3. 7243798 M
  4. 60789fc M
  5. 4c629bb M
  6.  
  7. And you push 6bbw138 commit by mistake to Master your result will be:
  8. Master
  9. 6bbw138
  10. 7243798 M
  11. 60789fc M
  12. 4c629bb M
  13.  
  14. If you want to come back to 7243798 or previous
  15.  
  16. 1) on local repo go to your master branch:
  17. git checkout master
  18. 2) Then we need the commit id to do a a reset of master branch in our case 7243798
  19. git reset --hard 7243798
  20. 3) We need to push this change to our branch, in our case is master branch
  21. git push origin master -f
  22.  
  23. I used bitbucket repo, this will be the output
  24.  
  25. Total 0 (delta 0), reused 0 (delta 0)
  26. To bitbucket.org:square1/www.myrepo.test.git
  27. + 6bbw138...7243798 master -> master (forced update)
  28.  
  29. And that's it you will have your branch on the previous commit.
  30.  
  31. Master
  32. 7243798 M
  33. 60789fc M
  34. 4c629bb M
Add Comment
Please, Sign In to add comment