简体   繁体   中英

git svn introducing carriage returns?

So I'm currently trying to merge code from a git repo into my svn repo using git-svn. My code inside the svn repo was developed on linux and does not have any carriage returns, and I believe the code from the git repo was also developed on linux since I don't see carriage returns in the files either. Here has been my method for pulling the files from the git repo into the 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

Once I hit step 10, I get messages for merge conflicts in literally every file. Upon investigating, I see that every file from MY svn repo now has carriage returns for some reason. I've already tried adding autocrlf = input to .git/config but it only fixed the problem in a small fraction of the files. I'm not really too sure what git-svn is doing here; I found these set of steps on this post . Any advice would be greatly appreciated.

Git has config stuff that can easily cripple a project changing EOL. I think the best you can do is try again but letting git know that you want to keep the files as is . You can do it at the branch level (as in, inside the project) by adding this line to .gitattributes:

* -text

That will spare you a lot of trouble.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM