My own basic Git cheat sheet

Git Cheat Sheet

  • Create
    • Clone Repository: git clone url
    • Create new local repository: git init
  • Local Changes
    • Detect pending changes: git status
    • Add files to commit: git add -p <filename> or git add .
    • Commit code: git commit -a -m “Comment”
    • Get code: git pull
    • Push changes: git push
    • View History: git logĀ  / git log -p <filename>
    • History/Blame: git blame <filename>
  • Branches, Merge & Rebase
    • Detect current branch: git branch
    • List all branches: git branch -av
    • Merge branch into current head: git merge <branch>
    • Rebase current head onto <branch>: git rebase <branch>

Git workflow: https://www.atlassian.com/git/tutorials/comparing-workflows

git