我最近决定尝试使用 git,并且非常喜欢使用 git,即使是在 Windows 上也是如此。
我当前的开源项目 lives on subversion ,所有开发人员都熟悉颠覆,所以我想暂时将颠覆作为“真理之源”。
尽管如此,我想使用 git,所以我继续创建了源代码的副本 on github使用 git svn .我所有的工作都是针对 github 中的源代码完成的,并将我的更改推送到 github。每隔几天我也会将我的更改推送到 svn 和 rebase。
最初的导入似乎没问题,但现在每次我执行“git svn rebase”时,我都会不断遇到冲突,即使是在我的 get 存储库中没有更改的文件上也是如此。这导致我 much pain .
例如。
$ git svn rebase First, rewinding head to replay your work on top of it... Applying: Added git ignore file c:/Users/sam/Desktop/MediaBrowserGit/trunk/.git/rebase-apply/patch:12: trailing whitespace. */obj/* error: .gitignore: already exists in index Using index info to reconstruct a base tree... :12: trailing whitespace. */obj/* warning: 1 line adds whitespace errors. Falling back to patching base and 3-way merge... Auto-merging .gitignore CONFLICT (add/add): Merge conflict in .gitignore Failed to merge in the changes. Patch failed at 0001 Added git ignore file When you have resolved this problem run "git rebase --continue". If you would prefer to skip this patch, instead run "git rebase --skip". To restore the original branch and stop rebasing run "git rebase --abort". rebase refs/remotes/git-svn: command returned error: 1
我的问题:
有什么方法可以告诉 git 使用 svn 作为源与 svn 同步,这样我就可以从头开始。 (导出最新的,检查更改并在某处重置 svn 引用)
是否有任何提示和技巧可以使此场景始终如一地工作?
我应该有core.safecrlf and core.autocrlf吗?选项设置为真?看来我需要跳一些圈套。
相关:
- http://kerneltrap.org/index.php?q=mailarchive/git/2008/4/16/1450834/thread
- http://markmail.org/message/vaois4kkr5ggugqs#query:git%20crlf+page:1+mid:i4flex6vmt5tdala+state:results
- http://code.google.com/p/msysgit/issues/detail?id=271
似乎让行尾正确是一种魔法。
(我意识到这个问题可能需要扩展,需要扩展的地方请评论)
最佳答案
您是否遇到行尾冲突? Git 有一些配置属性,您可以设置它们来更改它处理行尾字符的方式。我有以下设置:
# this makes git NOT attempt to convert line endings on commit and checkout
core.autocrlf=false
# this makes git check if the conversion done by autocrlf would be reversible
# this is probably not required because I do not have autocrlf turned on
core.safecrlf=true
请注意,我在 Windows 上,我所有的同事都在 Windows 上,我通过 git-svn 与 SVN 交互。这些设置似乎对我有用。
(来源:codinghorror.com)
关于windows - git 和 subversion 可以一起玩吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/973199/