Git
Contents |
Cheat Sheet
Always handy are Cheat Sheets [1].
Create & Clone | Add & Remove | ||
---|---|---|---|
Create new repo | git init | Add changes to INDEX | git add <filename> |
Clone local repo | git clone /path | Add all changes to INDEX | git add * |
Clone remote repo | git clone username@host:/path/to/repo | Remove / Delete | git rm <filename> |
Commit & Synchronize | Branches | ||
---|---|---|---|
Commit changes | git commit -m "Message" | Create new branch | git checkout -b <branch> i.e.: git checkout feature-x |
Push changes to remote repo | git push origin master | Switch to master branch | git checkout master |
Connect local repo to remote repo | git remote add origin <server> | Delete branch | git branch -d <branch> |
Update local repo with remote changes | git pull | push branch to remote repo | git push origin <branch> |
Merge | Tagging | ||
---|---|---|---|
Merge changes from another branch | git merge <branch> | Create tag | git tag <tag> <commit-ID> |
View changes between 2 branches | git diff <src-branch> <trg-branch> | Get commit IDs | git log |
See also
Reference
- ↑ Roger Dudler, Sheet Cheat