Guest User

Untitled

a guest
May 22nd, 2018
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.72 KB | None | 0 0
  1. A -> B -> C -> D -> HEAD
  2.  
  3. $ git revert --no-commit D
  4. $ git revert --no-commit C
  5. $ git revert --no-commit B
  6. $ git commit -m "the commit message"
  7.  
  8. $ git revert --no-commit D
  9. $ git revert --no-commit C
  10. $ git revert --no-commit B
  11. $ git commit -m "the commit message"
  12.  
  13. $ git revert --no-commit D
  14. $ git revert --no-commit C
  15. $ git revert --no-commit B
  16. $ git commit -m "the commit message"
  17.  
  18. $ git checkout -f A -- .
  19. $ git commit -a
  20.  
  21. $ git reset --hard A
  22. $ git reset --soft @{1} # (or ORIG_HEAD), which is D
  23. $ git commit
  24.  
  25. $ git reset --hard A
  26. $ git reset --soft @{1} # (or ORIG_HEAD), which is D
  27. $ git commit
  28.  
  29. git revert master~3..master
  30.  
  31. A <- B <- C <- D <- BCD' <- HEAD
  32.  
  33. # revert all commits from B to HEAD, inclusively
  34. $ git revert --no-commit B..HEAD
  35. $ git commit -m 'message'
  36.  
  37. git reset --hard a
  38. git reset --mixed d
  39. git commit
  40.  
  41. git revert --no-commit HEAD~3..
  42.  
  43. git diff HEAD commit_sha_you_want_to_revert_to | git apply
  44.  
  45. git checkout <branch_name>
  46. git reset --hard <commit Hash for A>
  47. git push -f
  48.  
  49. git checkout testing
  50. git reset --hard abc1234
  51. git push -f
  52.  
  53. for i in `git rev-list <first-commit-sha>^..<last-commit-sha>`; do git revert -n $i; done
  54.  
  55. for i in `git rev-list <first-commit-sha>^..<last-commit-sha>`; do git revert --no-edit -s $i; done
  56.  
  57. o---o---o---o---o---o--->
  58. fff eee ddd ccc bbb aaa
  59.  
  60. for i in `git rev-list eee^..bbb`; do git revert --no-edit -s $i; done
  61.  
  62. $ git checkout -f <target-commit> -- .
  63.  
  64. $ git diff --name-status --cached <target-commit>
  65.  
  66. $ git rm <filespec>[ <filespec> ...]
  67.  
  68. $ git commit -m 'revert to <target-commit>'
  69.  
  70. $git diff <target-commit> <current-commit>
  71.  
  72. git revert HEAD
  73. git revert HEAD~2
  74. git revert HEAD~4
  75. git rebase -i HEAD~3 # pick, squash, squash
Add Comment
Please, Sign In to add comment