Skip to content

Instantly share code, notes, and snippets.

@celeryclub
Last active January 1, 2016 23:49
Show Gist options
  • Save celeryclub/69324aff26b1bced5443 to your computer and use it in GitHub Desktop.
Save celeryclub/69324aff26b1bced5443 to your computer and use it in GitHub Desktop.

Feature Branches

Start a branch for each new feature.

git checkout -b <branch>

Publish your branch and set up tracking.

git push -u origin <branch>

Then when you’re done committing to it, rebase it on master, force push it.

git rebase master
git push -f

Then merge it.

git merge --no-ff <branch>

Or, if it’s a single commit:

git merge <branch>

Stashes

Stash your changes to pull or move to a different branch when you have changes in the working directory.

git stash

Then, to see stashes:

git stash list

Then, to use a stash:

git stash pop <stash> (default is last)

Logging

Fancy logging with graph:

git log --oneline --abbrev-commit --graph
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment