Getting the repository

git clone trust.cse.ucsc.edu:/pub/git/wikitrust.git
git clone trust.cse.ucsc.edu:/pub/git/OcamlLdaLibs.git

Structure of the repository

The remote repository has the following branches:

Creating your branch

The best way to contribute is to create a branch for yourself, and to make modifications to your own branch. In this way, the code can be reviewed by others before it is merged into the master branch.

To create your own branch, here called luca (replace in the following instructions luca with your usual username), as an offspring of the master branch, proceed as follows:

git checkout master   # This puts you into the master branch
git checkout -b luca  # This creates the luca branch from the master branch, and put you there

This leaves you in the branch luca, where you can work at will. Obviously, you can have as many private branches as you like, and git will know how to merge them, but as a good habit, keep your main work in a branch that has your username, so others will know how to get your work.

Once you are ready to share with others your changes, you need to "push" your changes to the luca branch to the common repository. This can be done simply via:

git push origin luca

In general, to push a branch mybranch (whatever it is, even master) to the common repository, you have to do:

git push origin mybranch

If all the branches you want to push already exist on the common repository, you can push all your changes simply via

git push

Typical development cycle

Get the updates into the master branch. In general, you can do:

git pull origin master

or, if you have the master branch already checked out, you can do simply

git pull

which updates the current branch from its remote one. Have a look at what changed; gitk --all is your friend here. Now, you go into your own branch, called for instance ipye:

git checkout ipye

Suppose that you like the changes in the master branch, and you want to merge them into your own branch, so that you can start coding from the new changes. All you need to do is

git merge master 

Code as much as you want in the ipye branch. When you are ready, you can make the changes to your branch visible to all by making:

git push origin ipye

or if you want to push changes to all of the branches you touched (note: be careful! check that your changes to the stable and master branch have been approved), you can do:

git push

which will push to the common repository all branches that exist both in your repository, and on the common one.

Getting a copy of somebody else's branch

Suppose you are now ipye, and you become curious, and you want to see what Luca is doing. First, you have to make sure that you have up-to-date copies of the remote branches you are tracking. You can do this via

git fetch

Now you have a copy of Luca's branch in /remotes/origin/luca, but that is a remote tracking copy: it tracks the luca branch on the repository, but you cannot go into it and examine it. One way to examine it is to use gitk --all. But if you really want to have the branch for you, compile the code, etc etc, you can make your own copy of it via:

git checkout -b my-luca origin/luca

This will create a local branch called my-luca. You can examine it, and then, if you wish, you can merge it in your own:

git checkout ipye
git merge my-luca

Alternatively, if you want to merge the remote branch luca directly into ipye, without first examining it, you can also do directly:

git checkout ipye     # This moves you to branch ipye
git merge origin/luca # This merges the remote branch luca into ipye

Contributing to WikiTrust for UCSC WikiLab Members (last edited 2008-05-13 12:02:35 by LucaDeAlfaro)