Created
March 17, 2010 03:22
-
-
Save jtrupiano/334853 to your computer and use it in GitHub Desktop.
Use sed and awk to help me cleanse the first commit in a git repo
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Process used to ammend a commit way back in my log (to eliminate some sensitive information) | |
# Print the git log to a temp file | |
git log --pretty=oneline > git.log | |
git checkout -b new_branch SHA | |
# edit and ammend | |
git commit -a --amend | |
# Use sed to reverse the lines in the file | |
# Use awk to pull the first token (the commit) | |
# Then loop over them all and cherry-pick one at a time | |
for commit in `sed -n '1!G;h;$p' git.log | awk '{print $1 }'` | |
do | |
git cherry-pick $commit | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment