Last active
September 13, 2022 12:37
-
-
Save anton-dealmeida/0e307520cc7d00d4be5e7b22737b23c8 to your computer and use it in GitHub Desktop.
A simply little snippet to squash your git commits into one commit for merging back to your source branch.
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
| # Roll back all the commits done since branching from a develop branch but keep the changes. | |
| # Note: Be careful to not loose your changes after running this command. | |
| Write-Host "Rolling back commit tree to source branch." | |
| git reset $(git merge-base develop $(git rev-parse --abbrev-ref HEAD)) | |
| Write-Host "Remember to commit all your changes and to run git push -f" |
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
| # Roll back all the commits done since branching from a develop branch but keep the changes. | |
| # Note: Be careful to not loose your changes after running this command. | |
| # This one is experimental | |
| echo "Rolling back commit tree to source branch." | |
| git reset $(git merge-base develop $(git rev-parse --abbrev-ref HEAD)) | |
| echo "Remember to commit all your changes and to run git push -f" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment