Skip to content

Instantly share code, notes, and snippets.

@githubteacher
Created November 6, 2012 15:59
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save githubteacher/4025654 to your computer and use it in GitHub Desktop.
Save githubteacher/4025654 to your computer and use it in GitHub Desktop.
Øredev Git Workshop

Øredev Git Workshop

  • Some philosophical thoughts
  • Configuration
    • git config --global user.name "Name"
    • git config --global user.email "email@address.com"
    • git config --global color.ui auto
  • Creating a Repo
    • git init newproject
  • Add files
    • git add caesar.txt
    • git commit -m "Message"
  • Commit files
    • git commit -m "Message"
  • Look at diffs
    • git diff
    • git diff --staged
    • git diff HEAD
    • git diff --color-words
    • git diff --word-diff
  • Look at history
    • git log
    • git log --stat
    • git log --patch
    • git log --pretty=full
    • git log --pretty=raw
    • git log --pretty=raw -1
    • git config --global alias.lol "log --graph --pretty=oneline --abbrev-commit"
    • git config --global alias.lg "log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%ci) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative --all"
  • Deleting files
    • git rm <filename>
    • git add -u .
  • Move files
    • git mv <oldfile> <newfile>
    • git add -A .
  • Branching and merging
    • git branch <branchname>
    • git checkout <branchname>
    • git merge <branchname>
  • Network operations
    • Remotes
      • git remote add origin https:/...
    • Fetch/pull/push
      • git push -u origin master
      • git pull
      • git pull --rebase
      • git config --global branch.autosetuprebase always
      • git config branch.<branchname>.rebase true
    • Clone
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment