Skip to content

Instantly share code, notes, and snippets.

@GoodGuyGregory
Last active February 9, 2020 22:59
Show Gist options
  • Save GoodGuyGregory/5c06c0fb6691850e05e1bd7452c3d76d to your computer and use it in GitHub Desktop.
Save GoodGuyGregory/5c06c0fb6691850e05e1bd7452c3d76d to your computer and use it in GitHub Desktop.
Common Git Commands

Checking for Differences between local changes

git diff

Checking Differences between Branches

git diff <branch> <checkedout branch>

Git Log lists all commit shas and commits

git log

Tracking All Branches in a repo

git branch -a

this command shows all of the branches even remote branches not locally

Specify Tracking Branch with remote branches

Created Local Branches with remote branches being tracked

  1. git checkout -b <local-branch> <origin/<remote-name>: manually specifiy a tracking branch with the remote branch
  2. git checkout --track origin/<remote name>: sets tracking branch
  3. git checkout <remote-branch>: git will automatically look for remote branch names and add tracking, new commits wont be brought over automatically

Deleting Remote Branches

git push origin --delete <remote-branch-name>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment