Front End Engineering, May 2015

Commit often

If you commit often, you're able to easily throw away your changes without fear.

Warning: this command is irrecoverable

To discard, forever and without recovery, your changes in your working directory.

$ git checkout -- .

pretty log

$ git config --global format.pretty "%C(yellow)%h%Creset %s %C(red)(%an, %cr)%Creset"
$ git config --global core.pager "less -FRSX"

tig (a nicer looking git CLI)

$ brew install tig

Overview

  • Commits are created with git commit
  • Branches are just labels for commits
  • "Merging branches" means merging the histories of commits that two branches point at.
  • Most git commands operate on where HEAD is pointed
  • git pull is just git fetch and git merge in one command. It pulls in the history from the remote, and then merges it into HEAD.

Creating a branch

$ git checkout -b <branchname>

Merging a branch

To merge a branch INTO master

$ git checkout master
$ git merge <branchname>

Resources