GIT

Git is a distributed versioning and revision control system, initially created for the Linux kernel development.
Unlike centralised systems like cvs or svn (where a single server handles the versioning, and clients check out files into their working directory), in git every working directory fully mirrors the repository with all its history and can also handle working with several remote repositories.

In the case you want to use git you should read:

http://www.kernel.org/pub/software/scm/git/docs/gittutorial.html git tutorial, HIGHLY, recommended

http://www.kernel.org/pub/software/scm/git/docs/everyday.html everyday git, for the daily work

http://www.kernel.org/pub/software/scm/git/docs/user-manual.html git user manual, if you want to know everything

http://www.loria.fr/~molli/pmwiki/pmwiki.php/Main/See here you can find a pdf version of the user manual

https://git.wiki.kernel.org/index.php/GitSvnCrashCourse git for svn users

Configure git

Git includes name / mail adresses in the commit history, so you have to configure this.

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

some other things you might like to do:

git config --global core.editor emacs
git config --global color.ui auto # colorised `git diff` output, etc.
git config --global core.pager 'less -R -F -X' # use less as pager (e.g. for git diff), make output pretty
git config --global alias.ci commit # make `git ci` work too

To review your git configuration:

git config -l

Edition of the config file

git config -e

To highlight whitespaces in git diff, put this in your ~/.gitconfig file:

 [color]
    ui = true
  [color "diff"]
    whitespace = red reverse
  [core]
    whitespace=fix,-indent-with-non-tab,trailing-space,cr-at-eol

More aliases to add to the config file:

[alias]
 lg = log --graph --decorate --pretty=oneline --abbrev-commit # pretty  git log display
 lga = log --graph --decorate --pretty=oneline --abbrev-commit --all # more pretty git log display
 ign = ls-files -o -i --exclude-standard # list files that you told git to ignore

Git basics

Create a repository inside the current directory

git init

Add all the files under the current directory

git add .

Commit the things you added

git commit

Show the status of the working directory / current version

git status

Undo changes to <path> and get back the last version that was committed

git checkout <path>

To work with remote repositories: read up on git clone / push / pull ...

To turn your repository into a bare repo, just delete all the files except .git,
mv .git/* .; rmdir .git
Finally, edit the file called config and change bare = false to bare = true.

Some usecases how to use git for our software development:

Select patches for upload to the pro branch

getting ILC-Soft SVN into your personal git

Recently, many of the ILC-Soft CVS repositories have been converted to SVN repositories. You can use following procedure to import these SVN repositories:

# go to an empty directory for the new git repo
cd <my place>

flcini git
flcini svn

git svn clone -s http://svnsrv.desy.de/public/lccd/lccd lccd

Unfortunately, git-svn has to be installed by hand to the latest git version. Therefore, only the current version 1.6.3 supports this. Also there is currently no ssl support. Therefore, https: (which is shown in the ILCSoft example) has to be replaced by http:

getting ILC-Soft CVS into your personal git

ILCsoft/CALICE still uses the over aged CVS for archiving some of their software. Additionally, they use some non standard version which prevents to clone it into a git repository with standard tools. You need a special version of ccvssh_git to import these CVS repositories. Following procedure works:

# go to an empty directory for the new git repo
cd <my place>

# login details
export CVSROOT=:ext:anonymous@cvssrv.ifh.de:/marlin

# special version of CVSSSH
export CVS_RSH=/group/hcal/calice_soft/tools/bin/ccvssh_git

# login (password should be empty, should give ok as reply)
$CVS_RSH login

git cvsimport -v -r cvs Marlin

GITHowTo (last edited 2015-03-24 10:01:37 by AnnikaVauth)