Git Typealong

mkdir project
cd project
git init .

echo "hello" > hello.txt
git diff
git add .
git status
git commit -m "said hello"
git status

git log

echo "friend" >> hello.txt
git diff
git add .
git status
git commit -m "said friend"
git status

git log

Distributed Git Diagram

git conceptual model

Basic Git Commands

command description
git clone copy a remote repo to your local disk
git add stage your local changes
git commit save your local changes with comments
git fetch get the changes from a remote, but don't apply them yet
git pull sync and merge with the remote repo
git push send all your local changes to and merge with the remote repo
git checkout -b foo create a local branch named "foo"
git status run this all the time!
git diff show the changes since the last commit

Git Is Elegant

Git's fundamental data model is a linked list.

Because a commit contains a diff and a pointer to history, a commit represents both a minimal set of changes to some files in the repo, and a maximal set of the contents of all files in the repo.

Git Is Weird

"Git was written by very smart aliens." -Alex

here be dragons

Git has an elegant data model, but a clunky command-line interface.

Git Is Weird (examples)

Here are some examples of how some of git's commands are counterintuitive and inconsistent.

Don't bother to memorize these (yet)!

Branches

A branch is a pointer to a commit.

Named Branches

Simple Git Workflow

simple git workflow

http://www.slideshare.net/GoAtlassian/superpowered-ci-with-git-sarah-goffdupont

Pull Request

If you always use pull requests, then code on master is guaranteed to have been reviewed.

[TODO: screenshots]

Feature Branch Details

Feature Branch Rules

Code Review Rules

Apache Voting

An old open source trick to reach consensus in an online discussion: use the +1/+0/-0/-1 scale.

+1 : "I’m willing to try and convince you we should do this."

+0 : "I don't feel strongly about it, but I'm okay with this."

-0 : "I'd rather we didn't do this, but if others want it, I won't object."

-1 : "I strongly disagree and am willing to argue my case."

https://www.apache.org/foundation/voting.html#expressing-votes-1-0-1-and-fractions

GitHub Review

 Previous Lesson Next Lesson 

Outline

[menu]

/