Guest User

Untitled

a guest
May 20th, 2018
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.47 KB | None | 0 0
  1. # Process used to ammend a commit way back in my log (to eliminate some sensitive information)
  2.  
  3. # Print the git log to a temp file
  4. git log --pretty=oneline > git.log
  5.  
  6. git checkout -b new_branch SHA
  7. # edit and ammend
  8. git commit -a --amend
  9.  
  10. # Use sed to reverse the lines in the file
  11. # Use awk to pull the first token (the commit)
  12. # Then loop over them all and cherry-pick one at a time
  13. for commit in `sed -n '1!G;h;$p' git.log | awk '{print $1 }'`
  14. do
  15. git cherry-pick $commit
  16. done
Add Comment
Please, Sign In to add comment