Created
April 25, 2024 21:41
-
-
Save aldoyh/5609724c3d3efb54f27a102c2e3630d3 to your computer and use it in GitHub Desktop.
rev-commits
This file contains 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
#!/bin/bash | |
# Clone the original repo | |
git clone https://github.com/mohammadrz003/moonfo-youtube.git moonfo-youtube-original | |
# Navigate to the cloned repo | |
cd moonfo-youtube-original | |
# Initialize an empty commit history | |
git reset --hard HEAD | |
git clean -df | |
# Apply each commit in reverse order | |
for i in $(git log -1 --reverse); do | |
# Get the commit hash and message | |
COMMIT_HASH=$(git rev-parse $i) | |
COMMIT_MESSAGE=$(git show -s --format=%B $i) | |
# Apply the commit changes | |
git reset --hard $COMMIT_HASH | |
git apply <(git diff-tree -p $COMMIT_HASH HEAD) | |
# Print the commit message | |
echo "$COMMIT_MESSAGE" | |
done | |
# Remove the original repo and exit | |
rm -rf moonfo-youtube-original | |
exit |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment