Skip to content

Instantly share code, notes, and snippets.

@tlberglund
Created October 15, 2012 15:59
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 4 You must be signed in to fork a gist
  • Save tlberglund/3893268 to your computer and use it in GitHub Desktop.
Save tlberglund/3893268 to your computer and use it in GitHub Desktop.
JAX London Git Workshop Notes

JAX Git Workshop

Outline

  • git init project
  • git config --global user.name "Tim Berglund"
  • git config --global user.email "tlberglund@github.com"
  • git status
  • git add <file>
  • Diff
    • git diff
    • git diff --staged
    • git diff --color-words
    • git diff --word-diff
    • git diff -w
  • Logging
    • git log
    • git log --stat
    • git log --patch
    • git log --pretty=raw
    • git log --pretty=oneline --abbrev-commit --graph
    • Log live command: https://gist.github.com/3714970
  • Aliases
    • git config --global alias.lol "log --pretty=oneline --abbrev-commit --graph"
    • git config --global alias.lg "log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %C green(%ci) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative --all"
  • Deleting
    • git rm <file>
    • git add -u .
  • Moving
    • git mv <file> <newfile>
    • git add -A .
  • Collaborating
    • git remote add origin <repo url>
    • git push -u origin master
    • git config --global branch.autosetuprebase always
    • git config branch.master.rebase true
  • Branching
    • git branch <branchname>
    • git checkout <branchname>
    • git checkout -b <branchname>
  • Merging
    • git merge <featurebranch>
    • Resolving a conflicted pull request
      • git ls-remote origin
      • git fetch /refs/pull/18/head
      • git merge FETCH_HEAD
  • Rebasing
    • git rebase <feature>
    • git rebase -i HEAD~5
  • Undo
    • git reflog
    • git reset --hard HEAD@{1}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment