check "A successful Git branching model" link
The central repo holds two main branches with an infinite lifetime:
- master
- develop
Creating a feature branch
git checkout -b myfeature developIncorporating a finished feature on develop
git checkout develop
git merge --no-ff myfeature
git branch -d myfeature
git push origin developCreating a release branch
git checkout -b release-1.2 develop
./bump-version.sh 1.2
git commit -a -m "Bumped version number to 1.2"Finishing a release branch
git checkout master
git merge --no-ff release-1.2
git tag -a 1.2
git checkout develop
git merge --no-ff release-1.2
git branch -d release-1.2For hotfix branches check the mentioned link.
Nice log
git log --graphNicer log
git log --graph --full-history --all --color --pretty=format:"%x1b[31m%h%x09%x1b[32m%d%x1b[0m%x20%s"similar but shotrer
git log --format=oneline
git log --graph --all --simplify-by-decorationAnother nicer log
git log --oneline --pretty='%C(red)%h%CresetI%C(yellow)%d%Creset%s%C(green)(%cr)%Creset'Create aliases (e.g.for nice log)
git config alias.lg "log --oneline --pretty='%C(red)%h%CresetI%C(yellow)%d%Creset%s%C(green)(%cr)%Creset'"
git lg2 diffs
git diff
git diff ..stagedAdd and commit (without newly created)
git commit -am "<commit message>"Just move HEAD
git reset --softMove HEAD + adjust working directory
git reset --hardHEAD + index without working directory
git reset --mixed2 steps back
git reset --hard^^
git reset --hard~2git log master..myfeaturegit rebase mastergit bisect start head~5
git bisect rungit show-refgit cat-file -p [SHA part]git ls-tree -r [SHA part]