Created
June 8, 2024 14:50
-
-
Save damianpumar/9b6e1ac3c5dbd4258763f056e7e8ca3d to your computer and use it in GitHub Desktop.
Clear commits and push
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
HASH=$(git commit-tree HEAD^{tree} -m "๐ First commit") | |
git reset $HASH | |
echo "๐ First commit has been cleared" | |
sleep 0.2 | |
echo "Pushing to the current branch" | |
BRANCH=$(git rev-parse --abbrev-ref HEAD) | |
git push origin -f $BRANCH |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
If you want to clear all commits in your current branch, just execute this bash script.