start | find | index | login or register | edit
git-notes
by earl, 3781 days ago
i've collected a plethora of things related to git on deli (http://del.icio.us/earl/git); have a look there for tutorials and technical details.

commonly used commands

below is a list of git commands organised into 4 major groups. the comments are more often than not straight from git's docs, sometimes amended to more directly point to the command's main purpose (read: what i mainly use it for).

Repositories
------------

init create an empty git repository
clone clone a repository into a new directory
pull fetch from and merge with another repository
push push local changes to another repository

Changes
-------

status show the working tree status
add add file contents from working tree to index
add --patch select only parts of a file's content to be added
diff show changes between working tree and index
diff --cached show changes between index and local repos
diff HEAD show changes between working tree and local repos
commit record changes from index to local repos
checkout <path> restore file in working tree to state in index/local repos
rm remove file from the working tree/index
reset reset working tree/index to state in local repos

History
-------

log show commit logs
show show details about commits etc

Advanced
--------

fetch fetch from another repos
merge merge branches in local repos
branch list, create, or delete branches
rebase rewrite commit history
revert create and commit patch that reverses another commit

git branch in bash prompt

__git_ps1 is a helper script to display the current git branch in your bash prompt. simply add $(__git_ps1) to your PS1 bash prompt. the script takes a printf format string as optional argument (defaults to " (%s)").

publishing a local repository onto a remote server via ssh
rsync -avz -e ssh .git/ $USER@$HOST:$REPOPATH
git remote add origin ssh://$USER@$HOST$REPOPATH
git config branch.master.remote origin
git config branch.master.merge refs/heads/master
powered by vanilla
echo earlZstrainYat|tr ZY @.
earl.strain.at • esa3 • online for 6650 days • c'est un vanilla site