nix-dotfiles/home/programs/git/scripts/git-rebase-fixups.sh

11 lines
242 B
Bash
Raw Normal View History

2024-11-13 16:57:00 +01:00
if [ -n "${1:-}" ]; then
TARGET_BRANCH="$1"
shift
else
TARGET_BRANCH=$(git remote show origin | sed -n '/HEAD branch/s/.*: //p')
fi
FORK_POINT=$(git merge-base --fork-point "$TARGET_BRANCH")
git rebase "$FORK_POINT" --autosquash "$@"