git fetch -ap # get in sync w/ server
BRANCH_NAME=$(git symbolic-ref --short -q HEAD)
git checkout $BRANCH_NAME # switch to the appropriate branch
git reset --hard origin/$BRANCH_NAME # get my branch to be exactly the same as what's on the server
MERGE_BASE=$(git merge-base origin/$BRANCH_NAME origin/master) # get the commit where your branch originates
git reset --mixed $MERGE_BASE # reset to the point where your branch originates, but put your changes like you just made them
git add . # stage your changes for a new commit
# echo "Enter your commit message, followed by [ENTER]:"
# read MESSAGE
git commit -m 'Commit message here' # commit your new commit
git push origin $BRANCH_NAME -f # force push it up to the server. you are rewriting history (check that everything looks ok before doing this)
-
-
Save cameronehrlich/88f55996ecaa95173df18d91bcfc1a3a to your computer and use it in GitHub Desktop.
Squashing your commits into one commit without using interactive rebase.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment