4

Hey guys,

I'm trying to convert a SVN repository to Git and I want to keep the history. So far everything has been going more or less good but when I push the history (of commits etc.) doesn't get commited too. Is there a way to change that? What do I need to do to get my subversion changes/commits in git?

Comments
  • 0
  • 3
    Sorry, I don't get your question. Why would anything be committed during a push? A push is just copying existing commits on a branch from your repo to another one.
  • 1
    @gronostaj sorry I wasn't clear. I'm new to git. I meant that I have old SVN commit history which I want to push to my new git repository. My latest state gets pushed but nothing else.
  • 1
    You'll need some tool to convert the repo. Git doesn't understand SVN, it will only see your files as they are now.
  • 5
    I used Subgit for a work project to move several hundred SVN repos to git. It's free if you're doing a one-time conversion.

    You run it once pointing at your SVN repo and it creates a local git repo with all your history. Then you do a normal git push --mirror to your hosting platform.

    https://subgit.com/
  • 2
    Use git-Svn. It just creates a git commit for every svn commit and then you push the whole branch to master. It’s one command to do it, look it up online

    I can’t believe I ever used Svn or clearcase
  • 0
    @FrodoSwaggins i used that but my commit history doesn't show up when I look at the repo (on gitlab).
  • 0
    @jallman112 nice idea. Sadly I don't have administrative power over the git repository or the server it's installed on.
  • 0
    @KittyMeowstika Git is decentralized, you can do the work on your local repo and then push to the remote repo. No administrative power needed.
  • 0
    @gronostaj from what I understand submit needs to be installed on the remote server though. And that's something I can't do.
    Simply doing a git svn clone doesn't do the trick when I push the created repo.
  • 1
  • 0
    @KittyMeowstika I'm not familiar with subgit, but it's unlikely you'd need it remotely. All git repos are made equal. It doesn't even care if the repo you're pushing to is related to the one you're pushing from. A push just moves commits from here to there, simple as that. So just convert SVN repo to git repo locally with subgit or whatnot, check the history (git log), add the other repo as a remote and push.
  • 0
    @gronostaj I already did that with git svn and it only worked for my local repo but not the remote one.
    As for subgit it says so on their webpage. I don't know much about it either though.
  • 0
    @l-lin will try that again thanks
  • 0
    @KittyMeowstika That would mean your push is not working and that problem is not related to SVN. Did you get any interesting output? Were the commits showing in log?
  • 0
    @gronostaj interestingly enough only 3 commits show up when i type in git log. (there are definitely more). still only my latest shows up on gitlab with no apparent commit history
  • 0
    @l-lin git push --all resulted in an error for me. "failed to push some refs to [remote]"

    EDIT: nvm. git only shows three initially. when i scroll down everything seems to be there
  • 0
    NVM thanks all of you whatever i did, it works now? Everything is there
Add Comment