Victus Spiritus

home

Gotta Grok Git

09 Feb 2010

Git is a file syncronization, and source control tool. Git has been my enemy. It's still a spooky animal. Here's how I survive git now without letting it get in the way of me breaking new things.

Install Git Ubuntu/Debian linux:
sudo apt-get install git-core
(refer to references for windows or mac installs)

Setup:
git config --global user.email you@bigco.com
git config --global user.name "Your Name"

Setup new repo?
cd myprojectdirectory
git init
git add .
git commit -am "first commit message"

Grab a repo?
git clone git:repo/proj.git

Status:
git log

Good commit habit to a remote repo:
git commit -am "my new commit"
git pull repo
(no conflicts?)
git push
(if conflicts?)
*run around screaming and breaking things*
git mergetool
or read here

Revert:
git revert commitnumber
Or to revert one commit
git revert HEAD

Branch:
git branch mybranchname

Switch branch (changes files think lazy susan):
git checkout mybranchname

List branches:
git branch

Merge branch master into current branch
git merge master

References: