Last active
February 23, 2026 14:18
-
-
Save smuuf/c19f6192cb7d870bbcad66549d71cb42 to your computer and use it in GitHub Desktop.
git tidy-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
| #!/bin/bash | |
| # Put this somewhere in your $PATH and git will automatically use it when you run "git tidy-branch". | |
| echo "■ tidy-branch" | |
| echo "■ Premysl Karbula, 2025" | |
| echo | |
| echo "■ Usage: git tidy-branch <parent branch>" | |
| echo | |
| echo "This will run interactive rebase of the current branch up to the first common commit with the specified parent branch." | |
| echo "You should probably back up your current branch first." | |
| echo | |
| if [[ -z "$1" ]]; then | |
| echo "Error: Parent branch not specified." | |
| exit 1 | |
| fi | |
| echo -n "Press CTRL+C to abort or any other key to continue..." | |
| read -r -n 1 -s | |
| echo | |
| git rebase -i `git merge-base HEAD $1` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment