Created
August 1, 2021 05:35
-
-
Save iamtalhaasghar/057c3e8b05bd1c8fdb186e11851bbbda to your computer and use it in GitHub Desktop.
Some commands which help you to clean your git commit history.
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
# Sign all previous commits | |
git rebase --root --exec "git commit --amend --author='Talha Asghar <[email protected]>' --no-edit --allow-empty" | |
git rebase --committer-date-is-author-date --root | |
git push -f | |
# Sign all commits to-date but dont touch commits before this point in history .i.e. commit hash "SHA256HASHEXAMPLE0000" | |
# Replace "SHA256HASHEXAMPLE0000" with your commit hash | |
git rebase SHA256HASHEXAMPLE0000 --exec "git commit --amend --author='Talha Asghar <[email protected]>' --no-edit --allow-empty" | |
git rebase --committer-date-is-author-date SHA256HASHEXAMPLE0000 | |
git push -f | |
# to clone repos from a text file having those repos' links | |
while read p; do git clone "$p"; done < ~/Documents/github-cleaning/sources.txt | |
# to do something in subdirectories | |
for d in ./*/ ; do (cd "$d" && pwd); done | |
# search for all readmes in subdirectories | |
for i in $(find . -maxdepth 2 -type f -iname readme*); do echo $i;done | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment