Created
April 25, 2022 13:25
-
-
Save gmolveau/5721b9fd9e4b7b19c9f6afd1af19f729 to your computer and use it in GitHub Desktop.
git reset / squash all commits in branch into one single commit
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
# source : https://stackoverflow.com/a/24154149 | |
export BRANCH="main" | |
git checkout --orphan new-$BRANCH $BRANCH | |
git commit -m "Commit message that summaries all the commits" | |
# Overwrite the old branch reference with the new one | |
git branch -M new-$BRANCH $BRANCH |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment