Skip to content

Instantly share code, notes, and snippets.

@kuncevic
Last active May 22, 2018 06:33
Show Gist options
  • Save kuncevic/f238f4ac3a4f88bed47a339a158ee76a to your computer and use it in GitHub Desktop.
Save kuncevic/f238f4ac3a4f88bed47a339a158ee76a to your computer and use it in GitHub Desktop.
git cheat sheet
git config --get remote.origin.url
git remote show origin
git ls-remote --get-url
git add -A //stages All
git add . //stages new and modified, without deleted
git add -u //stages modified and deleted, without new
git reset -- main/dontcheckmein.txt
git reset filename
git commit -m "commit message"
git update-index --skip-worktree
git update-index --no-skip-worktree
git update-index --assume-unchanged
git update-index --no-assume-unchanged
git checkout -b branchName --track origin/branchName
git branch -D branchName
git checkout master
git reset --hard e3f1e37
git push --force origin e3f1e37:master
git checkout -f
git fetch --all
git reset --hard origin/master
git reset --hard = git push --force
git reset HEAD~
git clean -f -d
git clean -i -fd
git commit --amend
git log origin/master..HEAD
git diff origin/master..HEAD
git shortlog -s -n --all --no-merges
git shortlog -s -n --all --no-merges --since="01 Aug 2017"
git diff-tree --no-commit-id --name-only -r bd61ad98
git show --pretty="" --name-only bd61ad98
git diff-tree --no-commit-id --name-status -r bd61ad98
git show --pretty="" --name-status bd61ad98
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment