Skip to content

Instantly share code, notes, and snippets.

@Devwarlt
Last active May 5, 2021 13:58
Show Gist options
  • Save Devwarlt/8cd66126901ad3e296d1ba155f192168 to your computer and use it in GitHub Desktop.
Save Devwarlt/8cd66126901ad3e296d1ba155f192168 to your computer and use it in GitHub Desktop.
Useful Git commands

Commands

  • change default remote HEAD branch: git remote set-head origin <branch>
  • show local branches: git branch
  • show all branches (even deleted): git branch --all
  • delete local branch: git branch -d <branch>
  • delete remote branch: git push origin --delete <branch> or git push origin :<branch>
  • get git commits: git reflog
  • change git name: git config --global user.name "<name>"
  • change git email: git config --global user.email "<email>"
  • show all branchs (including local): git branch -a
  • stage all files: git add --all
  • get all log: git log
  • merge local branches from A to B: git checkout B then git merge A
  • checkout status: git status -s
  • get all used commands (since begining of prompt session): history
  • unset Git credentials: git config --global --unset credential.helper then git config --system --unset credential.helper
  • disable SSL certificate: git config http.sslVerify false or git -c http.sslVerify=false clone <repo url>
  • dynamic submodule update: git submodule foreach git pull origin master
  • delete all local tags: git tag -d $(git tag -l)
  • delete all remote tags: git push origin --delete $(git tag -l)
  • fetch all remote tags: git fetch or git fetch --tags --all
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment