Based on notes from a recent BarCamp, here’s my one-minute introduction to Git, a distributed revision control system (a system for managing collaborative changes to files, usually used for software development). This is probably only useful to someone who’s already a programmer and already trying to use git, as a kind of cheat-sheet.
Step 1: Create a directory with files in it. Done? Good. Let’s proceed. “cd” into the directory and…
$ git init <- initialise repo
$ git status <- tells you which files are / are-not in version control
$ git add ... <- add files to repo, do it for each "meaningful change"
$ git commit <- commit new files to repo
$ git commit -am "Feature 1" <- commit all changed files to repo, -m "message" sets message without loading $EDITOR
$ git log <- shows recent changes
$ git config user.email "firstname.lastname@example.org" --global <- configure email notifications
$ git branch feature1 <- create a "branch" for feature1. You should branch for each feature
$ git branch <- list branches. "*" indicates current branch
$ git checkout feature1 <- switch to branch "feature1"
$ gitk --all <- horrific-looking but useful GUI
$ git merge feature1 <- merge changes on feature1 into current branch(example assumes you're on a different branch)
If you get a merge conflict, it will look like this:
CONFLICT (content): Merge conflict in file1
Automatic merge failed; fix conflicts and then commit the result.
Hope this helps someone else as much as it helped me…