Git Cheatsheet
Basic Git Commands
Do something |
|
Branches
List local branches |
|
List all branches |
|
Create a branch |
|
checkout Create a branch |
|
Create and checkout a branch |
|
Delete local branch |
|
Force delete local branch |
|
Delete a remote branch |
|
Tagging
git provides 2 types of tags: * lightweight * annotated
Note
|
Tags are not pushed by default. You have to either push them explicitly or push them all git push <remote> --tags
|
List tags |
|
Search for specific tags |
|
Useful aliases and tips
If you use dev, test, prod style tags e.g. three-tier-app-prod-1.23 then sort’s `--version-sort
is useful.
e.g.
function gt { git tag -l "${1}*${2:-prod}*" | sort --version-sort }
Setting up linters
Ignore or deactivate a linter
git commit -an or --no-verify