maks blog
   


About
maks blog, Hacks, fun around free software.

maximilian attems
email maks

Subscribe
Subscribe to a syndicated feed of my weblog, brought to you by the wonders of RSS.

Flavours
There's more than one way to view this weblog; try these flavours on for size.

Blogs
Other blogs in our institute or friends.

       
Mon, 03 Jul 2006

git cheat sheet
Using git involves a decentral development even if central server is supported. Git is amazingly fast and scales very well. Some of the following commands may help to get used to it.

# clone the last revision localy
git clone /path/.git

# clone repo from remote pc                         
git clone git+ssh://user@host/path/.git

# create your own branch
git branch <username>

# set your email and name which will show up in the commits
git repo-config user.email "user@host.org"
git repo-config user.name "firstname name"

# show latest changes
git log
git log <file>
git show
git show <commitid>

# check which branch currently is active                                        
git branch

# create and use a test branch
git checkout -b test

<hackcodehackcompilehackcompile>

# commit either all or some parts related to the files
# please don't forget to add an meningfull desc
# the first line is the subject, all below the body
git commit -a
git commit file

# merge your test branch once your happy back to your branch
git checkout username
git pull . test

# undo all local modification as they b0rk
git checkout -f

# push your changes to the repo all can have access to
git push git+ssh://user@host/path/.git branch

# eventually delete the test branch
git branch -D test

# tag the current revision
git revert <commit-id>

# change commit message to last edit
# (yes that's the only one you can change others are protected)
git commit --amend

# delete last commit
git reset HEAD^

# cherry-pick a change from one local branch to another local branch.
git checkout <first local branch>
git log path/to/changed/file
git checkout <second local branch>
git cherry-pick <sha1 refspec from the previous 'git log' output>

# merging others changes
git fetch git+ssh//user@host/path/.git mater:incoming
git log mater..incoming
git checkout mater
git pull . bob-incoming

[/tech] permanent link