Skip to content

Instantly share code, notes, and snippets.

@ams0
Created February 12, 2021 15:58
Show Gist options
  • Save ams0/d2a5b0e1dba8f68d986359af610ede1b to your computer and use it in GitHub Desktop.
Save ams0/d2a5b0e1dba8f68d986359af610ede1b to your computer and use it in GitHub Desktop.
A script to rebase branch X from branch Y
#!/bin/bash
#Usage: gitrebase.sh <branch to rebase into> <branch to rebase from>
# $> gitrebase devel main
echo "Rebasing branch $1 from branch $2"
git checkout $1
git pull
git fetch origin $2
git rebase origin/$1
git push -u origin $1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment