Skip to content

Instantly share code, notes, and snippets.

@eovolkov
Last active September 1, 2015 06:07
Show Gist options
  • Save eovolkov/f41af9aa1ac142791222 to your computer and use it in GitHub Desktop.
Save eovolkov/f41af9aa1ac142791222 to your computer and use it in GitHub Desktop.
* `git branch -a` #show all branches
* `git log --oneline` #show log without context
* `git reset --hard HEAD~1` #remove last commit
* `git reset --hard <sha1-commit-id>` #remove commit by sha-id
* `git reset --hard HEAD~1 && git push origin HEAD --force` #remove last pushed commit
* `git config -l ` #show config from global + system + local
* `git merge source_branch` #merge from source branch to current
* `git merge commit-id-from-source_branch` #merge from commit of source branch to current
* `git log --graph --decorate` #show color log as graph
* `git push -f ` #“forced push” and overwrites the branch on the server. That is very dangerous when you are working in team.
* `git branch -D <branchName>` #remove local branch
* `git push origin --delete <branchName>` #remove remote branch
* `git push origin :<branchName> ` #remove remote branch
* `git stash` #Save changes like hidden and reset repo to HEAD
* `git stash list` #show hidden work
* `git config --list` #git config
* `git stash apply` #apply last hidden work
* `git stash apply --index` #apply last hidden work in index
* `git stash apply stash@{2}` #apply selected hidden work
* `git stash drop` #drop hidden work
* `git stash pop` #apply last hidden work and drop from stack
* `git update-index --assume-unchanged <file>` #Unwatch file in repo
* `git update-index --no-assume-unchanged <file>` #Rollback Unwatch file in repo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment