Git
Git switch - switch branches or xreatet
Git restore - restore a file to the version in a given commit or branch
Useful commands
git -am "Message commit" # Shortcut to
git commit --ammend ""
git fetch origin
git clean -df # Clean repo
git switch - # Go to last branch
git stash save <name>
git stash pop list
git stash apply <index>
git log --graph --oneline --decorate
git bisect start
git bisect bad
git bisect good <commit id>
## Squash
git rebase master --interactive
git commit --squash <branch>
git rebase master -i --autosquash
Git commit messages
See how a minor change to your commit message style can make you a better programmer.
Format: <type>(<scope>): <subject>
<scope>
is optional
Reset to origin branch
git fetch origin
git reset --hard origin/<branch>
Example
feat: add hat wobble
^--^ ^------------^
| |
| +-> Summary in present tense.
|
+-------> Type: chore, docs, feat, fix, refactor, style, or test.
More Examples:
feat
: (new feature for the user, not a new feature for build script)fix
: (bug fix for the user, not a fix to a build script)docs
: (changes to the documentation)style
: (formatting, missing semi colons, etc; no production code change)refactor
: (refactoring production code, eg. renaming a variable)test
: (adding missing tests, refactoring tests; no production code change)chore
: (updating grunt tasks etc; no production code change)