Git-Tricks

Refs


Awesome GitHub Commands Reference Sheet (Quick Reference)

HEAD^       # 1 commit before head
HEAD^^      # 2 commits before head
HEAD~5      # 5 commits before head

Branches

# create a new branch
  git checkout -b $branchname
  git push origin $branchname --set-upstream

# get a remote branch
  git fetch origin
  git checkout --track origin/$branchname

# delete local remote-tracking branches (lol)
  git remote prune origin

# list merged branches
  git branch -a --merged

# delete remote branch
  git push origin :$branchname

# go back to previous branch
  git checkout -

Collaboration

Submodules

Diff

Diff with stats

Just filenames

Log options

Misc

Cherry pick

Short log

Bisect

Manual bisection

Searching

GPG Signing

Refs

Branches

Collaboration

Submodules

Diff

Diff with stats

Just filenames

Log options

Miscellaneous

Cherry pick

Short log

Bisect

Manual bisection

Searching

GPG Signing

#### If you found this guide helpful feel free to checkout my github/gists where I host similar content:

bgoonz’s gists · GitHub

bgoonz — Overview _Web Developer, Electrical Engineer JavaScript | CSS | Bootstrap | Python | React | Node.js | Express | Sequelize…_github.com

Or Checkout my personal Resource Site:

a/A-Student-Resources _Edit description_goofy-euclid-1cd736.netlify.app

By Bryan Guner on March 6, 2021.

Canonical link

Exported from Medium on August 31, 2021.

Last updated

Was this helpful?