User Tools

Site Tools


computing:git

CMSSW and github

SVN switcher guide

cms-uzh repository at CERN

Cloning the repository

There are two ways to clone the repository:

git clone https://:@git.cern.ch/kerberos/cms-uzh #With valid kerberos credentials
git clone https://git.cern.ch/reps/cms-uzh #LDAP authentication

Web access to the repository

CERN Knowledge Base on git service

Private copy of a repository and pull requests

Instead of directly pulling and pushing changes to a project repository, it is much safer to work on a private copy (called fork) on the github server and transfer changes only via pull request from the privat repository to the project repository on the server.

1. Go to https://github.com/cms-edbr/ExoDiBosonResonances and click on “Fork” and choose you user area on github.

2. Clone code from your private copy of the repository

export GITUSER=`git config user.github`
echo "Your github username has been set to \"$GITUSER\""
git clone git@github.com:$GITUSER/ExoDiBosonResonances
cd ExoDiBosonResonances

This command will also give this repository the name “origin”.

3. Make an alias to the main repository

git remote add cms-edbr git@github.com:cms-edbr/ExoDiBosonResonances

You can check the result of this command by typing

git remote -v

4. Update to the edbr_tautau branch (this will move the HEAD):

git co edbr_tautau

Fetch latest changes in branch edbr_tautau from the main repository

git fetch cms-edbr edbr_tautau

and merge

git merge edbr_tautau cms-edbr/edbr_tautau
git merge FETCH_HEAD origin/master #generally

To preview what this would do you can try

git log ..cms-edbr/edbr_tautau
git diff ...cms-edbr/edbr_tautau #used to be FETCH_HEAD

5. Make local changes, add these files for a commit and commit

git add some_modified_file
git status
git commit -m"message"

6. Push changes in edbr_tautau branch to you private repository on github server

git push origin edbr_tautau
git push origin master #generally

7. Got to you private respository https://github.com/GITUSER/ExoDiBosonResonances and make a pull request to move your changes to the project repository by clicking on “Pull Request”, “New Pull Request”, “Edit”, and select the edbr_tautau branch in both repositories. You may have to click on “Edit” twice to do so. You may either ask someone else to “Merge” this pull request or do it by yourself if you have the rights and are confident.

computing/git.txt · Last modified: 2017/03/04 15:20 by iwn