Git Cheat Sheet

Common Terminology

Create & Clone

Show changes

Show history

Commit

Branches

Tags

Use tags to save a specific version (the commit relations up to this point) of a project. Merging older commits into the branch afterwards hence wont affect the tag.

Update

Publish

Merge

Rebase

Use rebase with care! It will rewrite the history and therefore requires additional efforts when working with a team! Dont rebase unless every project member knows about the required workflow!

Stash

Use stash to save all current changes to a clipboard and retrieve them later.

Revert

Git is merciful and lets you undo allmost all changes with ease.

Configuration

Commit Message Format

[BUGFIX] Short summary

Optional explanatory text. Separated by new line. Wrapped to 74 chars. Written in imperative present tense ("Fix bug", not "Fixed bug").

Help others to understand what you did (Motivation for the change? Difference to previous version?), but keep it simple.

Mandatory title prefix: [BUGFIX], [FEATURE] (also small additions) or [TASK] (none of the above, e.g. code cleanup). Additionall flags: [!!] (breaking change), [DB] (alter database definition), [CONF] (configuration change), [SECURITY] (fix a security issue).

Bug tracker refs added at bottom (see http://is.gd/commit_refs).

Resolve #42
Ref #4 #8 #15 #16

shortened, detailed example at http://is.gd/commitformat

Best practices

Sources

About