简体   繁体   中英

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.

在此处输入图片说明

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 aa range of commits ( between c75e75c and HEAD) and push to remote branch ( branch/app_v2 ) ?

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 ?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM