Skip to content

Instantly share code, notes, and snippets.

@MatthewJDavis
Last active October 30, 2021 13:19
Show Gist options
  • Save MatthewJDavis/d423519cb972d0b4b536e7bafcd66c5c to your computer and use it in GitHub Desktop.
Save MatthewJDavis/d423519cb972d0b4b536e7bafcd66c5c to your computer and use it in GitHub Desktop.
Useful Git commands
# Check remote
git remote -v
# Configuration
git config --global --list
git config --global user.name
git config --global user.email
git config --list
# for PowerShell set function to see graph
function gitgraph {git log --oneline --graph --decorate --all}
# branch
git branch
git checkout -b branch-name
git branch -d branch-name
# Reset commit
git reset HEAD~1 --soft #resets repo, not working or stage dirs
git reset <few chars of the commit> --soft
git reset <few hard of the commit> --hard #resets repo and working directory!
# Tagging
git tag v0.0.2 # tags current commit
git tag v0.0.1 <commitid> # tags previous commit
git tag --list
git tag -a v0.0.1 <commitid> -m "comment" # annotated tag
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment