0

I have a SVN branch which I want to move to git but with all the history of the branch. I tried a lot of permutations and combinations as below but none of them worked. Could someone please help me? I am new to git. I have tried svn to git migration without history and it has worked properly.

      svn log -q <SVN_BRANCH_REPO> | awk -F '|' '/^r/ {sub("^ ", "", $2); sub(" $", "", $2); print $2" = "$2" <"$2">"}' | sort -u > users.txt

    git svn clone --stdlayout --no-metadata --authors-file=users.txt <SVN_BRANCH_REPO> tmp

the tmp here returns an empty directory. I tried :

     git svn clone -r HEAD --no-metadata --authors-file=users.txt <SVN_BRANCH_REPO> tmp1

Post this I did the following steps:

    cd tmp1
    git svn fetch
    git remote add origin git@gitlab.com:mehtakar/gitexample.git
    git commit --amend --reset-author
    git push -u origin master

this also does not commit the history in the master branch. Could someone please let me know what am I missing?

Karan mehta
  • 89
  • 2
  • 10
  • Did you see this answer https://stackoverflow.com/a/3972103/3535187? Does your SVN-Repo has following layout "trunk/, branches/, tags/"? – Jakob Liskow Jan 13 '21 at 21:20
  • @JkbLskw yes i did check but didnt help. Yes my repo has trunk branches and tags – Karan mehta Jan 14 '21 at 07:10
  • Is there a log for your command "git svn clone"? That would help. – Jakob Liskow Jan 14 '21 at 07:29
  • @JkbLskw : the second git clone command in my question jus creates a new directory and the log for these are simple logs as below: – Karan mehta Jan 14 '21 at 09:28
  • Initialized empy git repository in C:\Temp A file A File1 W: +empty_dir: com/main/java/filter W: +empty_dir: com/test/resources/conf r101300= 5ecdfjvbgg837453bt34t73ttb39ugb3 (refs/remotes/git-svn) Checked out HEAD: SVN_REPO_LINK Creating empty directory : com/main/java/filter Creating empty directory: com/test/resources/conf – Karan mehta Jan 14 '21 at 09:33
  • What is the encoding of your users.txt file? – Jakob Liskow Jan 14 '21 at 09:34
  • @JkbLskw I have not specified it, how do we do that? – Karan mehta Jan 14 '21 at 09:36
  • Let us [continue this discussion in chat](https://chat.stackoverflow.com/rooms/227324/discussion-between-jkblskw-and-karan-mehta). – Jakob Liskow Jan 14 '21 at 09:43

0 Answers0