Serverless Architecture

This website and domain name are for sale.

This is my Git cheat sheet. There are many like it, but this one is mine.

Here is a short and simple list of some of the common git commands that I find myself using.  This list will be continuously updated as needed.

  • Pull all remote branches
    • git fetch origin
  • To see the branches available for checkout
    • git branch -v -a
  • Create a branch from existing remote
    • git checkout -b NewBranchName origin/OldBranchName
  • Create a branch from existing
    • git checkout -b NewBranchName OldBranchName
  • Push local branch to new remote branch with upstream tracking
    • git push -u origin NewBranchName
  • Push local branch to remote branch with upstream tracking and a new remote branch name
    • git push -u origin local-name:remote-name
  • Show uncommitted changes
    • git status
  • Show Local and Remote branches
    • remote and local
      • git branch -a
    • remote only
      • git branch -r
    • local only
      • git branch
  • Save all local branch changes
    • git add *
  • Commit all saved changes with a message
    • git commit -a -m “message”
  • Pull from remote branch to local branch
    • git pull origin BranchToPull
  • Remove uncommitted local changes
    • reset
      • git reset –hard
    • move back 1
      • git reset –hard HEAD^
    • move back N
      • git reset –hard HEAD~N
  • Delete branch
    • Local
      • git branch -d the_branch_to_delete
    • Remote
      • git push origin :the_branch_to_delete
      • git push origin –delete the_branch_to_delete

Written for
Written by Jeff Mangan

Updated: 1919/09/08 — 1:32 PM

Leave a Reply

Serverless Architecture © 2020 Frontier Theme