git
Last edited April 12, 2008
More by Ian Lewis »

Single Branch Setup

If you want to checkout only one single branch, here's what you would do:

Here's how you as a developer get your local git repository if you only want trunk (git-1.5.2):

git-svn clone -r16500:HEAD svn+ssh://USERNAME@svn.gnucash.org/repo/gnucash/trunk

That's it. The revision subset r16500:HEAD will download approx. 30-40 MB of data. If you download larger revision spans, the download amount might go up into the hundreds of MBs.

Here's how you run the equivalent of "svn update":

git-svn rebase

That's it.

Once you committed your changes to your local git repository, here's how you commit the local changes upstream into gnucash's SVN repository:

git-svn dcommit
An introduction to git-svn for Subversion/SVK users and deserters
utsl.gen.nz/talks/git-svn/intro.html#howto-fetch

...make changes to your local branch

Once you have some edits you want to commit, you can use git-commit to commit them. Nothing (not even file changes) gets committed by default; you'll probably find yourself using git-commit -a to get similar semantics to svn commit.

This is because git has a powerful concept of a staging area, called the index, which is where you can prepare your changes before you actually save the commit.

$ vi CREDITS
$ git commit -a
committed tree 6b513546099f01826c5cc7bc25042d00bc2560b0
$ 
An introduction to git-svn for Subversion/SVK users and deserters
utsl.gen.nz/talks/git-svn/intro.html#howto-fetch

..by checking out just the trunk from SVN

It is probably second fastest to just check out the SVN head using git-svn; this is a bit like setting up a mirror path with svk mirror, then syncing only to the head revision using svk sync -s NNN (where NNN is the head revision, found below using svn log):

$ svn log https://svn.perl.org/parrot/trunk|head
------------------------------------------------------------------------
r17048 | bernhard | 2007-02-19 07:32:13 +1300 (Mon, 19 Feb 2007) | 3 lines

Remove the PIR.pg and bc.pg examples as they are
now covered by languages/abc and languages/PIR.

------------------------------------------------------------------------
r17047 | bernhard | 2007-02-19 07:09:00 +1300 (Mon, 19 Feb 2007) | 5 lines

[languages/PIR]
$ mkdir parrot
$ cd parrot
$ git svn init https://svn.perl.org/parrot/trunk
Initialized empty Git repository in .git/
git-svn Using higher level of URL: https://svn.perl.org/parrot/trunk => https://svn.perl.org/parrot
$ git-svn fetch -r17048
        A       DEPRECATED.pod
        A       debian/libparrot-dev.install
        A       debian/parrot-doc.install
...
        A       examples/streams/ParrotIO.pir
        A       examples/streams/Include.pir
        A       examples/streams/Filter.pir
r17048 = a57c09abef48d73f3c74c6a307793301b5956bfd (git-svn)
Checking files out...
 100% (2959/2959) done
Checked out HEAD:
  https://svn.perl.org/parrot/trunk r17048

$
Howto use Git and svn together | Flavio Castelli
www.flavio.castelli.name/howto_use_git_with_svn

In these days I’ve heard lot of rumors around Git. After reading some manual/tutorial/guide I discovered that it can be really useful, especially if you spend lot of time coding off-line (that’s my situation).

This is a really small howto that describes how to work on a project versioned with svn (maybe taken from KDE repository ) using git.

What’re the advantages?

Since Git is a distributed revision control system (while svn is a centralized one) you can perform commits, brances, merges,… on your local working dir without being connected to internet.

Next time you’ll be online, you will be able to “push” your changes back to the central svn server.

Steps to follow:

You’ve to:

  1. install git and git-svn
  2. create the working dir: mkdir strigi
  3. init your git working dir: cd strigi && git-svn init https://svn.kde.org/home/kde/trunk/kdesupport/strigigit-svn init command is followed by the address of the svn repository (in this case we point to strigi’s repository)
  4. Find a commit regarding the project (you can get it from cia version control). Warning:the command git-log will show project’s history starting from this revision.
  5. Perform the command git-svn fetch -rREVISIONWhere REVISION is the number obtained before.
  6. Update your working dir: git-svn rebase

Now you’ll be able to work on your project using git as revision control system.

To keep update your working copy just perform:

git-svn rebase

You can commit your changes to the svn server using the command:

git-svn dcommit

In this way each commit made with git will be “transformed” into a svn one.

Solve git-svn rebase problems

While adding new cool features to your program, you may experiment some problem when synchronizing with the main development tree. In fact you have to commit all local modifications (using the git-commit command) before invoking git-svn rebase.

Sometimes it isn’t reasonable since your changes are not yet ready to be committed (you haven’t finished/tested/improved your work). But don’t worry, git has a native solution also for this problem, just follow these steps:

  1. put aside your changes using the command: git-stash
  2. update your working copy using: git-svn rebase as usual
  3. take back your changes typing: git-stash apply
  4. clear “the stash” typing: git-stash clear

After the first step all your uncommitted changes will disappear from the working copy, so you’ll be able to perform the rebase command without problems.

For further informations read git-stash man page.

That’s all.

The content on this page is provided by a Google Notebook user, and Google assumes no responsibility for this content.