0

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.

1 Answers1

0

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.

eftshift0
  • 26,375
  • 3
  • 36
  • 60
  • This method did not work :(. I tried adding the .gitattributes file at both the branch level and the user level. – Cyrus Farsoudi Mar 06 '19 at 19:03
  • Normally this is git config to blame. When you copy the files from the original location into your new repo, what type of file do they have? (and that is, before running any git command on them). You can use `file` for that. `file blahblah.txt`. That should tell you if it's CRLF. – eftshift0 Mar 06 '19 at 19:19