如何使用git-svn跟踪仅限本地的更改/更改集? [英] How do I track local-only changes/change sets with git-svn?

查看:111
本文介绍了如何使用git-svn跟踪仅限本地的更改/更改集?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想要在我的本地git存储库中跟踪的文件,当我运行git-svn dcommit时,这些文件不会检入中央svn存储库。我经常对版本库中跟踪的文件进行长期的本地更改。有时用于调试代码。我也有我想跟踪的项目IDE文件。使用普通的旧svn,我只是将这些文件放入一个标签为XYZ:Do not Check In的更改列表中,然后在我确实需要更改时手动处理问题。



理想情况下,我想检查我的主分支中的更改,但是设置一些可以防止这些特定更改传播到svn回购的东西。我会以传统方式使用git和git-svn,但某些提交从未被推上去。很明显,我可以在每次进行提交时手动执行此操作,但这是一种痛苦。



我考虑并放弃了一些事情。我不想排除这些文件,因为有时我需要进行更改,以便获取提交。另外,我希望这些文件出现在我创建的任何仅限本地的分支中,例如IDE文件。但是,我无法将这些更改分离到单个分支,因为我将在每个分支中都需要它们,就像IDE文件一样。它看起来像内疚或stgit可能做我想要的东西,但它并不明显,因为他们添加自己的复杂层上的Git,我仍然在学习。

解决方案我目前的解决方案是使用堆叠的git(stg)并将这些本地更改作为单独的修补程序进行维护。当我需要提交到Subversion时,我做了一个

  stg pop#命名不应该被提交的补丁
stg commit#其余的补丁提交
git svn dcommit
stg push#命名本地使用的补丁

把它们作为单独的补丁维护的好处是,我可以很容易地拥有修补程序来修改我的单元测试以测试不同的数据库后端。因此,通常我会针对Oracle进行测试,但是如果我想检查Derby,我会做

pre $ stg push local-mods-derby
ant测试
stg pop

或者如果我想测试PostgreSQL, run

  stg push local-mods-test-postgresql 
ant tests
stg pop

这里,local-mods-derby和local-mods-test-postgresql是补丁名称。 / p>

因此,使用stg保留单独的工作区很容易。


I want to have files that I track in my local git repository that do not get checked in to the central svn repository when I run git-svn dcommit. I often have long-lived local-only changes to files tracked in the repository. Sometimes it's for debugging code. I also have project IDE files that I'd like to track. With plain old svn, I would just put those files into a changelist labelled "XYZ: DO NOT CHECK IN," and then just manually deal with the problem when I actually DO have changes that I need to commit.

Ideally, I would like to check my changes into my master branch but set something that prevents those specific changes from propagating to the svn repo. I would use git and git-svn in the conventional way, but certain commits never get pushed up. Obviously, I can do this manually every time I make a commit, but that's a pain.

I've considered and discarded a couple of things. I don't want to exclude these files, because sometimes I need to make changes that DO get dcommitted. Also, I'd like these files to appear in any local-only branches I create, like in the case of IDE files. However, I can't isolate these changes to a single branch because I will want them in every branch, as with the IDE files. It looks like something like guilt or stgit may do what I want, but it's not obvious, as they add their own layer of complexity on top of git, which I'm still learning.

解决方案

My current solution to the problem is to use stacked git (stg) and maintain these local changes as separate patches. When I need to dcommit into Subversion, I do a

stg pop # naming the patches that should not be commited
stg commit # the rest of the patches to commit
git svn dcommit
stg push # naming the patches that are used locally

The nice thing about maintaining these as separate patches is that I can easily have patches that modify my unit tests to test different database backends. So normally I test against Oracle, but if I want to check against Derby, I do

stg push local-mods-derby
ant tests
stg pop

or if I want to test against PostgreSQL, I run

stg push local-mods-test-postgresql
ant tests
stg pop

Here, "local-mods-derby" and "local-mods-test-postgresql" are the patch names.

So maintaining separate patches of work is very easy with stg.

这篇关于如何使用git-svn跟踪仅限本地的更改/更改集?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆