Skip to content

Instantly share code, notes, and snippets.

@molotovbliss
Created February 5, 2022 22:01
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save molotovbliss/651d2b4be52d73ebf1c6a0a30d0a9e60 to your computer and use it in GitHub Desktop.
Save molotovbliss/651d2b4be52d73ebf1c6a0a30d0a9e60 to your computer and use it in GitHub Desktop.

Useful Commands

If a lot of changes has happened upstream you can replay your local changes on top of these, this is done with rebase, e.g.:

git fetch upstream
git rebase upstream/master

This will fetch changes and re-apply your commits on top of these.

This is generally better than merge, as it will give a clear picture of which commits are local to your branch. It will also “prune” any of your local commits if the same changes have been applied upstream.

You can use -i with rebase for an “interactive” rebase. This allows you to drop, re-arrange, merge, and reword commits, e.g.:

git rebase -i upstream/master

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