Visualize:
~/project.git $ gitk --all
New repo:
~ $ mkdir project.git
~ $ cd project.git
~/project.git $ git init
Clone:
~ $ git clone git://gitorious.org/project/project.git
~ $ cd project
~/project $ git remote rm origin
~/project $ git remote add origin git@gitorious.org:project/project.git # ??? are these 2 needed??
~/project $ git pull git://gitorious.org/project/project.git master # get it up2date
Push:
~/project.git $ git add newfile
~/project.git $ git commit -m "commit message" # git commit -a -m "commit message", if you made a change to a file
~/project.git $ git push origin master
Merge together with another branch:
~/project.git $ git checkout master # if you don't want it directly, create a branch and change to it before pulling
~/project.git $ git pull git://gitorious.org/~user/project/users-clone.git
General branching:
~/project.git $ git branch # local branches
~/project.git $ git branch -r # remote branches
~/project.git $ git branch -a # all branches
Create new local branch and work:
~/project.git $ git branch
* master
~/project.git $ git branch new-branch
~/project.git $ git checkout new-branch
~/project.git $ ...
~/project.git $ git commit -a -m "commit message"
~/project.git $ git push
# assuming we are done with the branch, and we want it in
~/project.git $ git checkout master
~/project.git $ git rebase new-branch
~/project.git $ git branch -d davids-first
~/project.git $ git push
# assuming we don't want it anymore
~/project.git $ git checkout master
~/project.git $ git branch -D davids-first
Rebase:
~/project.git $ git branch
master
* new-branch
~/project.git $ git rebase master # advances new-branch to master
~/project.git $ git push
Remote branching:
~/project.git $ git push origin origin:refs/heads/new-branch # create new remote branch
~/project.git $ git checkout --track -b new-branch origin/new-branch # it isn't mandatory to call the
~/project.git $ ... # local branch the same, but why not?
~/project.git $ git push origin :heads/new-branch # we want to get rid of the crap we did (or we rebased master)
~/project.git $ git checkout master
~/project.git $ git branch -D new-branch
Last modified: August 30, 2009
© 2009 by David Madl. Impressum | Home (English) | Home (Deutsch) | Processing time: 0.173 s | IPv4
Write a comment
The fields e-mail and website are optional. Your e-mail-address will not be displayed, it's only for me to be able to reply.