View on GitHub

MiB Beam Spot

Milano Bicocca development and operations of CMS Beam Spot

Download this project as a .zip file Download this project as a tar.gz file

What?

This is meant to be the code sharepoint for Milano Bicocca group venture on the CMS Beam Spot development and operations

Before you start

Installation

setup area

cmsrel CMSSW_7_2_3
cd src

initialize a git repository

git init

add the common Milano Bicocca remote github repository you will push your changes here (not into your personal github!) pull requests into the official cmssw github will be made from the common github

git remote add mib git@github.com:MilanoBicocca-pix/cmssw.git

add also the official cmssw remote github, so that we can align from time to time

git remote add official-cmssw git@github.com:cms-sw/cmssw.git

checkout just what you need, not the full burden

git config core.sparsecheckout true
echo RecoVertex/BeamSpotProducer >> .git/info/sparse-checkout
git pull mib <BRANCH>

now you're up and running

Very minimal how to

First, do your modifications, then the usual way to keep them on the record and to propagate them to everybody is

  1. git add FILE1 FILE2 ...
  2. git commit -m "hey hey I saved the world today"
  3. git push mib BRANCH

now, if our private mib BRANCH reached the point it worths being put into the official CMSSW

  1. (after 1., 2. and 3.) do a pull request http://cms-sw.github.io/tutorial.html#do-a-pull-request

Tricks worth noting

Check the differences between your HEAD and a given branch

cd $CMSSW_BASE
cmsenv
git fetch REMOTE_NAME
find RecoVertex/BeamSpotProducer/ -wholename 'RecoVertex/BeamSpotProducer/*/*.*' -type f | git diff REMOTE_NAME/BRANCH_TO_COMPARE_AGAINST --

Check the differences between your HEAD and a given branch, but only display the names of the files that changed

git diff --stat BRANCH_TO_COMPARE_AGAINST

More extended git cheatsheet (in light of our scope)

set architecture for 75X

setenv SCRAM_ARCH slc6_amd64_gcc491

create the release

cmsrel CMSSW_7_5_X
cd CMSSW_7_5_X
cd src

initialise a git repo

git init

tell git what remote github repos you’ll be interested in

git remote add cms-official git@github.com:cms-sw/cmssw.git             # official CMSSW repository (you can push changes here)
git remote ass mib          git@github.com:MilanoBicocca-pix/cmssw.git  # MiB common repository (you have full access rights)

now you’ve got two remotes you can pull down from, cms-official and mib

now enable the sparse-checkout feature. You don’t want to have the whole wealth of CMSSW packages in your working directory, do you?

git config core.sparsecheckout true
echo RecoVertex/BeamSpotProducer >> .git/info/sparse-checkout

now pull down the branch you want to work on from the remote mib repository

git pull mib BRANCH

side note 1: “git pull mib BRANCH” is effectively equivalent to git fetch mib ; git merge BRANCH side note 2: in case you already have something in your current branch, conflicts may happen. If you want to solve the conflicts, edit the conflicting files and commit them, then push. If you simply want to stop, cleanup and back off because you suspect you’re messing it up, then do git merge —abort

now you can do all the changes you want

check if there’s any file you want to stage and, later commit

git status

stage the files that will go into the next commit

git add FILE1 FILE2

suppose theres one file that you modified but you don’t want to stage nor commit

git checkout —- FILE

now you’re ready to commit, bear in mind that it’s a snapshot of the whole repo!

git commit -m “my message”

if you want to start a new branch right from where you are now (first make sure your staging area is clean, aka git status should return clean)

git checkout -b NEW_BRANCH # please note that NEW_BRANCH did not exist until now

to hop on and off a branch (as above, git status should return clean before you jump)

git checkout BRANCH1
git checkout BRANCH2

suppose you’re on BRANCH1 and you want to wipe it clean and align it to some other branch BRANCH_TO_ALIGN_TO. Beware, you’re gonna loose all your mods!

git reset —hard BRANCH_TO_ALIGN_TO

now git diff BRANCH_TO_ALIGN_TO should return nothing, i.e. you forced BRANCH1 to point to the exact commit BRANCH_TO_ALIGN_TO points to

if you want to display all the branches you have available locally

git branch -a

you’ll notice that some of them look like BRANCH some others like remotes/REMOTE/BRANCH the former are your local branches, whereas the latter are the branches that were available in the oven REMOTE frozen at the time of your last git fetch/pull REMOTE you did. These get regularly update every git fetch/pull REMOTE

Authors and Contributors

Riccardo Manzoni (@rmanzoni)
Sara Fiorendi (@sarafiorendi)
Simone Gennai (@gennai)
Mauro Dinardo (@dinardo)

Support or Contact

manzoni AT cern DOT ch

About GitHub Pages

This automatic page generator is the easiest way to create beautiful pages for all of your projects. Author your page content here using GitHub Flavored Markdown, select a template crafted by a designer, and publish. After your page is generated, you can check out the new branch:

$ cd your_repo_root/repo_name
$ git fetch origin
$ git checkout gh-pages