home contents changes options help subscribe edit

URL-s summary:

Web browser: http://git.sv.gnu.org/gitweb/

Basic commands

Developer setup

(For git 1.5.1 or newer)

Your identity for when you push commits (strongly recommended):

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

Enable colors (optional):

git config --global color.diff auto
git config --global color.status auto
git config --global color.branch auto

Developer basic commands

Shallow checkouts

When bandwidth is an issue, people can download the latest version of your repository without downloading all the history, using "shallow checkouts". Note that such a copy has limitations, see http://www.kernel.org/pub/software/scm/git/docs/git-clone.html , option --depth for details.

Example:

$ git clone --depth 1 git://git.sv.gnu.org/gnulib.git
Initialized empty Git repository in /tmp/gnulib/.git/
remote: Counting objects: 9897, done.
remote: Compressing objects: 100% (5462/5462), done.
Indexing 9897 objects...
remote: Total 9897 (delta 7382), reused 5737 (delta 4419)
 100% (9897/9897) done
Resolving 7382 deltas...
 100% (7382/7382) done

$ du -sh gnulib/.git
6,3M   gnulib/.git

$ du -sh full-gnulib/.git
28M    full-gnulib/.git

git-cvsserver pserver compatibility

You can download a git repository using the CVS client, thanks to a pserver-compatible server from git:

$ cvs -d:pserver:anonymous@pserver.git.sv.gnu.org:/autoconf.git co -d autoconf master
cvs checkout: Updating autoconf
U autoconf/.cvsignore
U autoconf/.gitattributes
U autoconf/.gitignore
U autoconf/.x-sc_prohibit_atoi_atof
U autoconf/.x-sc_space_tab
U autoconf/.x-sc_sun_os_names
U autoconf/.x-sc_trailing_blank
U autoconf/.x-sc_useless_cpp_parens
U autoconf/AUTHORS
U autoconf/BUGS
U autoconf/COPYING
...

CVS import

Git comes with the right tool, called git-cvsimport.

This tool use an authors file to map username->real name (option -A) it looks like this:

rms = Richard M. Stallman <rms@gnu.org>
toto = Another User <me@mydomain.com>
...

Common invokation:

git-cvsimport -A ../authors.txt -p x -v -d :pserver:anonymous@cvs.savannah.nongnu.org:/sources/$project $module

Most remarks given in the following section (SVN import) also applies to CVS import.

SVN import

Git comes with 2 SVN-related tools: git-svnimport and git-svn. git-svnimport is for importing revisions (a one-shot import, or incrementally); git-svn is a 2-way gateway to a SVN repository, similar to SVK, more useful for maintaining a local branch than for importing a repository (IMHO). We'll use git-svnimport.

Those tools use an authors file to map username->real name (option -A) it looks like this:

rms = Richard M. Stallman <rms@gnu.org>
toto = Another User <me@mydomain.com>
...

Common invokation:

git-svnimport -v -I .gitignore -A ../authors.txt file:///home/me/svn_repo

To ignore branches:

git-svnimport -v -I .gitignore -A ../authors.txt -b idontexist file:///home/me/svn_repo

git-svnimport assumes there's a trunk, a branches, and a tags directory (names are configurable) and ignores other directories. You may run into troubles if your layout changed during your former SVN life.

You'll usually perform the import several times before getting what you want. For this reason it's preferable to rsync the SVN repository locally, or create it from a dump:

rsync -av rsync://svn.sv.gnu.org::svn/myproject svn_repo
 
wget http://svn.gna.org/daily/myproject.dump.gz
svnadmin init svn_repo
zcat myproject.dump.gz | svnadmin load svn_repo/

GNU Arch import

Use git-archimport.

Example importing a project with a project--main--1.0 main archive and a project--release--1.7 tag, converting the Arch-style names into Git-style names:

git-archimport me@domain.tld--2007/project--main--1.0:master project--release--1.7:v1.7

Push existing or converted repository

If you are importing a repository with tags, e.g. for past releases, use the --tags option to send them with the initial import:

git push --tags -v login@git.sv.gnu.org:/srv/git/project.git master



subject:
  ( 7 subscribers )