Skip to content

Instantly share code, notes, and snippets.

@gurunars
Created November 5, 2024 10:18
Show Gist options
  • Save gurunars/488cbb2aba4ba42004d96e9ace666ec7 to your computer and use it in GitHub Desktop.
Save gurunars/488cbb2aba4ba42004d96e9ace666ec7 to your computer and use it in GitHub Desktop.
Rebase feature branch
FEATURE_BRANCH=fill-me
echo "Backup feature branch to server"
git checkout ${FEATURE_BRANCH}
git push origin ${FEATURE_BRANCH}
echo "Refresh main"
git checkout main
git pull origin main
echo "Rebase feature branch"
git checkout ${FEATURE_BRANCH}
git rebase main
# If there are any conflicts, resolve them and run `git add .` and `git rebase --continue`
echo "Push to rebased branch to server"
git push origin ${FEATURE_BRANCH}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment