开发者

SVN GIT local custom changes

I'm in such situation: There is open source project still developed by 3rd party. I'm using it and have my custom source code changes on top of it. I don't want to commit anything back to 3rd party repository. Only get the newest updates.

From the other side I want to re-distribute source code (3rd party code and my changes) to other locations. I.e. i开发者_如何学Cf there is a bugfix update from 3rd party I want just update my main repository and re-distribute the changes to other locations. The same applies when I do some custom updates.

I've been thinking here for a while, but could not find most suitable solution.

My idea:

  • updates from 3th party using SVN to $REPODIR
  • $REPODIR will be my GIT repository - all other locations will pull then changes from here.
  • I will do my local changes and push them to $REPODIR

Somebody have a better solution or has solved similar problem other way ?


The git-svn command will help you with this. I'm using it for all SVN repos I have to work with, works like a charm!

The following commands should get you started:

mkdir svn-checkout

cd svn-checkout

git svn init --stdlayout < your SVN URL >

git svn fetch

Now take a big break, fetching may take days (!) depending on the number of revisions, branches and tags in the SVN repository. After that, issue

git gc

and take another big break. You might want to watch memory consumption.

Good news is that setup has to be done only once. After that, the entire repository is on your local machine -- diff, log and annotate can be carried out without bothering the SVN server.

After setup, you can start editing the code and commit using git. Whenever you want to get the latest updates from SVN, run

git svn rebase

The result is a git repo that has the current SVN state plus your changes. You might have to resolve conflicts introduced by your changes, though.

See http://justaddwater.dk/2009/03/09/using-git-for-svn-repositories-workflow/ for a more elaborate explanation.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜