🚰 workflow & collaboration
or, the "working with others" part.
(even if that other person is just your future self trying to understand WTF your code does years later).

tl;dr

  • collaboration:
  • with yourself: reduce email, maker time, headphones, hide
  • newbies: commit code the first day!
  • staging / canary servers: dogfood before prod does.

repository

git

git is the way we’ll save code and how we can enable collaborating with others in the future. GitHub has become almost synonymous with git as its most widely used implementor of the technology.

first, initialize a repository:
git init [projectname]

basic commands
git help [command] — for help on any particular command. or just git help.
git clone [url] — copy a repository to your local machine.
git status — get the state of your repository.
git pull — get the latest state of your repository from the central repository.
git push — push out your changes to the central repository.
  • git pull --rebase — i tend to use the --rebase flag to not have thousands of “merge” commits in history.
git log — show the history of the repository. optionally, you can specify a branch name.
  • git log --stat — a more detailed view into the log.
git branch — manage different versions of your repository.
  • git branch -D — delete the branch.
git add [file] — add a particular file to the pending commit.
git reset [file] — remove a file from the pending commit.
git mv [orig] [dest] — move a file in your repository.
git rm [file] — remove a file from your repository.
git commit — create an entry with your latest work.
  • add -a to add all current files.
git checkout [branch] — switch to another branch.
  • git checkout -b [branch] — create the branch.
git checkout [file] — checkout the original copy of the file.
git diff — show differences made to the current branch.