1

I created a local git repository from an svn branch in order to use git's features and dcommit when all the work is ready. I had a very large change and it was postponed. The branch I was working on in svn has been merged to the trunk and removed. A new release branch was created. If I were in svn, I would switch to the new branch and pull. Instead, I cloned the new branch and I want to merge my changes into it, then commit them. However, git apparently can't see their shared history and all my changes look like a conflict:

$ git svn clone --revision HEAD  https://svnedge.yadayada.com/svn/ASSIST/branches/FY15Q4X_AugMaint FY15Q4X_AugMaint
...edit,build,test....
$ git svn clone --revision HEAD  https://svnedge.yadayada.com/svn/ASSIST/branches/FY16Q1X_OctMaint FY16Q1X_OctMaint
$ git branch maint
$ git remote add hankr ../FY15Q4X_AugMaint
$ git checkout -t hankr/maint
$ git merge maint
... almost every file a conflict...

It was suggested that if I pulled in the entire repository, git would be able to see the shared history. I don't have any commit history to preserve, I just want my changes brought into the new release. Thanks for any tips.

1

1 Answer 1

0

I was merging in the wrong direction. Adding the remote "hank" and my prior work "../FY15Q4X_AugMaint" as a remote is correct. You can pick up where you left off, that is, you can replay changes to SVN that you preserved in a local git-svn repo, by rebasing them onto the new SVN branch.

$ git remote add or ../ASSIST
$ git checkout -t hankr/maint

Your config should look like this:

# .git/config (were these created from command line or added?
[remote "hankr"]
    url = ../ASSIST
    fetch = +refs/heads/*:refs/remotes/hankr/*
[branch "maint"]
    remote = hankr
    merge = refs/heads/maint

Now you should be able to rebase:

$ git rebase -i master
$ git merge maint

Of course, SVN lets you switch branches, so I could have done that, pulled the changes and resolve any conflicts on files.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.