Some git instructions

How to install git?

Source code and User Guide available in http://git.or.cz
At lxplus one can use the available binary by
source /afs/cern.ch/user/k/kaitanie/public/git/gitenv.csh

Introducing oneself to git:

git config --global user.name "Your Name Comes Here"
git config --global user.email you@yourdomain.example.com

Useful git commands:

git clone http://cmsdoc.cern.ch/~slehti/HiggsAnalysis.git
git commit -a // committing changes to existing files only
git add file; git commit // adding and committing a new file
git rm file; git commit // removing a file and committing
git remote add public ${HOME}/public/html/HiggsAnalysis.git
git remote add public ssh://markka.it.helsinki.fi:/home/ad/web1/slehti/CompInHEP_k2023.git
git remote add public ssh://slehti@lxplus.cern.ch/afs/cern.ch/user/s/slehti/public/html/HiggsAnalysis.git
git remote add public ssh://slehti@markka.it.helsinki.fi/home/ad/web1/slehti/CompInHEP_k2023.git git push public refs/heads/master:refs/heads/master
git tag -l
git push --tags public
git diff HEAD^ HEAD
git checkout file // git revert
git checkout HEAD~n file // git revert file from HEAD-n commits
git checkout tags/pre2017 -b pre2017 // checkout a tag git branch --track branch origin/branch
git push public :refs/heads/pattuplev26 // delete remote branch

Problems getting the clone due to SSL authentication:

git config --global http.sslVerify false

How to make a public repository (to be done before "git remote add" command):

cd $HOME/public/html
mkdir HiggsAnalysis.git
cd HiggsAnalysis.git
git --bare init
mv hooks/post-update.sample hooks/post-update
git update-server-info

Taking code from others:

git remote add matti http://cmsdoc.cern.ch/~mkortela/HiggsAnalysis.git
git fetch matti
git merge matti/master

Links:

http://git.or.cz
http://jonas.nitro.dk/git/quick-reference.html
http://git-scm.com/book/en/Git-Internals-Maintenance-and-Data-Recovery
cms-sw.github

Last change on January 29, 2009 by S. Lehti.