Skip to content

Instantly share code, notes, and snippets.

@springmeyer
Created December 22, 2015 17:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save springmeyer/b2cb1b3b0f00fc6268b1 to your computer and use it in GitHub Desktop.
Save springmeyer/b2cb1b3b0f00fc6268b1 to your computer and use it in GitHub Desktop.
Poor person's git squash
# start in a custom branch
git checkout <custom branch>
# make sure you have latest master pulled in
git pull origin master
# then diff out the difference between your branch and master
git diff origin/master > my.diff
# then delete your local branch
git checkout master
git branch -D <custom branch>
# recreate the branch
git branch <custom branch>
git checkout <custom branch>
# now apply the diff and add as a single commit
git apply my.diff
git commit -a -m "all changes in one clean commit"
# force push now which will overwrite remote branch with new branch with a single commit
git push -f
@wilhelmberg
Copy link

# start in a custom branch
git checkout
# make sure you have latest master pulled in
git pull origin master

Ah, interesting:

git pull origin master

should be done from within <custom branch>?

That's probably where my problems with the Studio Classic PRs (and the latest changes from master not showing) originated from.
I did do a pull, but from within master, not <custom branch>.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment