Skip to content

Instantly share code, notes, and snippets.

@scottnixonjr
Last active September 15, 2020 21:45
Show Gist options
  • Save scottnixonjr/8c740d2e28a62f77b110a880a1548688 to your computer and use it in GitHub Desktop.
Save scottnixonjr/8c740d2e28a62f77b110a880a1548688 to your computer and use it in GitHub Desktop.

Git Guide

I forgot to rebase and instead merged from the Trunk branch.

Create a patch of your Branch with all Trunk changes included, you can move those changes to a new branch. And you can rebase as needed to keep a clean commit history.

git diff Trunk Branch1 > ../patchfile
git checkout Branch2    
git apply ../patchfile

Soft Reset: Non-interactive squash

If you don't care about your commit history, you can soft reset to convert it to a single commit. Example combines 10 commits.

git reset --soft HEAD~10
git commit -m "Combined feature changes."
git push origin my-branch --force
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment