git - git svn 引入回车?
问题描述
所以我目前正在尝试使用 git-svn 将来自 git repo 的代码合并到我的 svn repo 中。我在 svn repo 中的代码是在 linux 上开发的,没有任何回车,我相信 git repo 中的代码也是在 linux 上开发的,因为我也没有在文件中看到回车。这是我将文件从 git repo 拉入 svn repo 的方法:
1. mkdir new_directory
2. cp -a /path/to/git/repo/. new_directory && cd new_directory
3. rm -rf .git/
4. git init
5. vim .git/config (and add):
[svn-remote "svn"]
url = https://link/to/svn/repo
fetch = :refs/remotes/git-svn
6. git add .
7. git commit -m "message"
8. git svn fetch svn
9. git checkout -b svn git-svn
10. git merge master
一旦我点击第 10 步,我就会在每个文件中收到合并冲突的消息。经过调查,我发现我的 svn repo 中的每个文件现在都有回车,因为某种原因。我已经尝试添加autocrlf = input
到 .git/config ,但它只解决了一小部分文件中的问题。我不太确定 git-svn 在这里做什么;我在这篇文章中找到了这些步骤。任何建议将不胜感激。
解决方案
Git 具有可以轻松破坏更改 EOL 的项目的配置内容。我认为你能做的最好的就是再试一次,但让 git 知道你想保持文件原样。您可以通过将此行添加到 .gitattributes 在分支级别(如在项目内部)执行此操作:
* -text
这样可以省去很多麻烦。
推荐阅读
- java - 如何在 MVVM 中调用网络两次?
- ada - Ada : 检查除法的结果是否没有十进制数
- kotlin - 有人可以解释这个 Kotlin 表达式吗?
- r - 解释“Rprof”的内存分析输出
- c# - Razor Pages Post 返回 400
- ios - TapGestureRecognizer 在另一个类中调用函数并访问第一类的变量
- python - 有没有更简单的方法来执行和分组矩阵求和?
- javascript - Node.js async.mapSeries 用于具有 2000 个对象数组的 JSON
- css - 父元素下方的伪元素
- ios - 如何在用户关闭模式之前显示 ActionSheet