Tuesday, January 13, 2009

Minimal GIT guide

1. Create a new branch on the remote git repository

git push origin origin:refs/heads/

e.g git push origin origin:/refs/heads/nemesis-debug

creates a branch called nemesis-debug on the remote repository.

Confirm this by typing git branch -r. Your new respository should appear there.

2. create a local branch to track the newly created remote branch.

git checkout --track -b

e.g git checkout --track -b nemesis-debug origin/nemesis-debug

3. make all necessary changes.

4. commit your changes
a.add files/directories you want to commit
git add
git add .   # adds all the files in the directory recursively

b. commit
git commit -m "commit-message"

c. push all your changes to the repository

git push origin
e.g git push origin nemesis-debug


5. In case you screwed up and want to delete the remote branch 

git push origin :heads/
e.g git push origin :heads/nemesis-debug

No comments: