Skip to content

Instantly share code, notes, and snippets.

@oehnstro
Last active December 19, 2015 18:19
Show Gist options
  • Save oehnstro/5997916 to your computer and use it in GitHub Desktop.
Save oehnstro/5997916 to your computer and use it in GitHub Desktop.
Collection of git tips and tricks

GIT TIPS & TRICKS

New branch workflow

Create your branch:

git checkout -b your_branch

Push to remote:

git push -u <remote-name> <branch-name>

e.g.

git push -u origin new-feature

Rebase

e.g.

git rebase -i HEAD~5
  • Reorder by reordering the lines in the editor
  • Squash commmits by squashing them on to the commit before
  • Cancel by removing all the commit lines

Partial add

Add only some modifications of a file or changeset.

git add -p [file]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment