Skip to content

Instantly share code, notes, and snippets.

@schaechinger
Created June 19, 2018 09:42
Show Gist options
  • Save schaechinger/891271b4156ce994edf29f292a3a58d7 to your computer and use it in GitHub Desktop.
Save schaechinger/891271b4156ce994edf29f292a3a58d7 to your computer and use it in GitHub Desktop.
Squash all changes of a feature branch to create pull requests with one single commit.
#!/bin/sh
git fetch
branch=$(git symbolic-ref -q HEAD)
branch=${branch##refs/heads/}
branch=${branch:-HEAD}
default=$(git symbolic-ref refs/remotes/origin/HEAD | sed 's@^refs/remotes/origin/@@')
git rebase -i origin/$default
git push origin +$branch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment