Search code examples
gitgit-svngit-branch

push from git/svn repo into a git/branch at specific commit


At one time, the SVN repo was cloned at commit c75e75c. One team worked on git/master, another team worked on SVN.

  • We are using git-svn on the svn repo.
  • I could merge svn/trunk into git/master but this would terribly awful. So I prefer to push all the commits after c75e75c into the branch/app_v2
  • The git/branch is simply a copy of svn/trunk after commit c75e75c.

enter image description here

Tried with git push <remotename> <commit SHA>:<remotebranchname> How can I pushing specific commit to a remote, and not the previous commits? . I created a remote branch/app_v2. But the commits SHA on git-svn and git repo are not the same. Even they have a common history.

How to push a a range of commits ( between c75e75c and HEAD) and push to remote branch ( branch/app_v2 ) ?


Solution

  • OK here is the cookbook :

    on the Git repo , create the remote branch ( note it is the same revision as SVN's c75e75c but it doesn't have the same has name on the other git repo )

    git checkout -b <branch_name> <revision_hash>
    

    then push the branch to remote repo

    git push origin <branch_name>
    

    on SVN repo , roll back to the revision to push

    git checkout c75e75c
    

    push to the remote branch

    git push origin <current_locale_branch>:<branch_name> 
    

    Any questions ?