Created
February 16, 2022 07:08
-
-
Save barahilia/d2da8f627f40a8ddc947d6ab51b6711f to your computer and use it in GitHub Desktop.
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
# Fresh repo and some master history | |
git init squash | |
cd squash/ | |
echo one > a | |
git add . | |
git commit -m "First commit" | |
echo two >> a | |
git commit -m "Second commit" | |
git commit -am "Second commit" | |
# Here we start working on a branch | |
git checkout -b branch | |
echo three >> a | |
git commit -am "Branch first" | |
echo four > b | |
git add . | |
git commit -m "Branch second" | |
# Precaution - save the current tip | |
git tag branch_before_sqaush | |
# Finally, the actual sqaush | |
git reset master | |
git add . | |
git commit -am "Branch squashed commit" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment