Show Menu
Cheatography

Git flow Cheat Sheet (DRAFT) by

This is a draft cheat sheet. It is a work in progress and is not finished yet.

Main branches

Main stable branche
master
Unstable branch
dev
Dev's personal branches
<ta­sk_­nam­e>_­<ta­sk_­des­c>
Every developer starts it's own branch from dev. All the work done is assembled in dev. Once or two in a week dev is merged to master in stable state.
 

Branch flow

0. Make sure you are on dev branch *
git checkout dev
1. Update dev branch
git pull origin dev
2. Create your own branch
git branch <br­anc­h_n­ame>
3. Switch to your branch
git checkout <br­anc­h_n­ame>
4. Add changes to commit
git add .
5. Do the commit
git commit -m "­commit messag­e"
6. Switch to dev
git checkout dev
7. Update dev
git pull dev
8. Switch to your branch
git checkout <br­anc­h_n­ame>
9. Rebase to updated dev
git rebase dev
10. Switch again to dev
git checkout dev
11. Merge your branch to dev
git merge <br­anc­h_n­ame>
12. Push changes to server
git push origin dev
* Use git status to check you current branch
 

Starting work

Clone repo
git clone <re­po_­url>
Get branch
git fetch origin dev
Switch to branch
git checkout dev

Usefull tips

Check current state
git status .
Read history of commits
git log
Read file history
git log <fi­le>
Add one file
git add <fi­le>
Revert changes in file
git checkout -- <fi­le>
Delete untracked files
git clean -fd
Delete branch
git branch -d <br­anc­h>
Get changes in file
git diff <fi­le>
Get changes to be commited
git diff --staged
In <fi­le> you can use * to skip some parts of the path or mask your files