Git 通过 svn - 管理文件
也许我错过了一些关于通过 svn 使用 gi 的事情,但是我如何保留一组本地修改的文件而不将这些更改推送到 subversion。
这是我破碎的工作流程。
(在master上)git svn rebase
git checkout -b 问题
*在我的所有分支上应用我需要的更改*
*更改*
git commit *更改*
git checkout大师
git合并问题
git svn dcommit
问题在于 svn rebase,甚至提交,我丢失了本地修改但未签入的文件。我不想提交这些文件,因为我不想将它们拉入 svn 提交。
在这种情况下我的工作流程应该如何运作?
Perhaps I'm missing something about using gi through svn, but how do I keep around a set of locally modified files without pushing those changes to subversion.
Here's my broken workflow.
(on master) git svn rebase
git checkout -b issue
*apply changes I need on all my branches*
*changes*
git commit *changes*
git checkout master
git merge issue
git svn dcommit
The problem lies in the fact that svn rebase, or even committing, I lose my locally modified but not checked in files. I don't want to commit the files, because I don't want them pulled into an svn commit.
How is my workflow supposed to work in a situation like this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我的 git-svn 工作流程如下所示:
最后一个
rebase
步骤将从工作分支中删除已提交到上游的所有提交。对于
cherry-pick
步骤,我实际上使用了一个小型 shell 脚本,该脚本会自动获取所有提交,除了那些在其描述中包含“NOCOMMIT”的提交。您可以使用其他指示器,例如“LOCAL”或“NOPUSH”或任何您喜欢的指示器。这些提交是那些挂在“工作”分支上并且不会被推送到 Subversion 的提交。这是我的
pull-work
脚本:请注意使用
tac
之类的微妙之处,它们颠倒了列出的提交的顺序,以便它们以相同的顺序应用于 master。My git-svn workflow looks something like this:
The last
rebase
step removes all the commits from the work branch that have already been committed upstream.For the
cherry-pick
step, I actually use a small shell script that automatically gets all the commits except those that have "NOCOMMIT" in their description. You could use another indicator like "LOCAL" or "NOPUSH" or whatever you like. These commits are those which hang around on the "work" branch and aren't pushed up to Subversion.Here's my
pull-work
script:Note the use of subtleties like
tac
that reverse the order of the listed commits so they get applied to master in the same order.听起来好像你的 HEAD 正在被重置。为了避免这种情况,请使用 svn dcommit --no-rebase 。
但是,我认为您的工作流程有些破坏。拥有未提交的文件有点违背了目的,不是吗?
您可能应该使用 git stash。这使得您的新工作流程:
适当地命名您的存储,您应该能够做您想要做的任何事情。
It sounds as though what's happening is that your HEAD is being reset. To avoid this, use
svn dcommit --no-rebase
.However, I think your workflow is somewhat broken. Having uncommitted files kind of defeats the purpose, doesn't it?
You should probably use
git stash
. This makes your new workflow:Name your stashes appropriately, and you should be able to do whatever it is you're trying to do.
如果存储库中不存在该文件,您可以随时将其(或模式)添加到
. Then it would be ignored in git commits and would never end up being pushed into SVN.
If it's a file that doesn't exist in the repo, you could always add it (or a pattern) to
. Then it would be ignored in git commits and would never end up being pushed into SVN.