February 16, 2010
I'm been using Git for a while at work, here just a few commands i use on a daily basis... just as a reminder for me:
User details:
git config --global user.name "Daniel Morales" git config --global user.email daniel@isp.com
Clone a repository:
git clone ssh://USERNAME@git.server.com/PATH/TO/MODULE
Create a new branch (locally):
git branch "new_branch_name"
Checkout a branch:
git checkout "branch_name"
Update changes from server:
git pull
Commit changes:
git commit
Add files:
git add /path/tho/file.c
View local changes:
git diff
View log:
git log
Reset (revert) changes of a single file:
git reset HEAD /path/to/file.c
Push (upload) changes to server:
git push
Push a new branch (created locally) to server:
git push origin "branch_name"
Run a git command, in 'testing' mode (it doesn't affect anything):
Add --dry-run as an option of any git command you use.
Download a branch from server:
git remote fetch origin
Setup a local branch to track the remote branch:
git branch --track [local-name] origin/remote-name
Switch to local-name:
git checkout [local-name]
Un trackfile:
git rm --cached application.log
Initial PUSH:
git push origin master
Apply a patch:
git apply patchname.diff
I'm a 32-years old programmer and web developer currently living in Montevideo, Uruguay. I been programming since I was about 15 y.o, and for the past 12 actively working in the area.