简体   繁体   English

在特定提交时从git / svn repo推送到git / branch

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

At one time, the SVN repo was cloned at commit c75e75c. 一次,在提交c75e75c处克隆了SVN存储库。 One team worked on git/master, another team worked on SVN. 一个团队在git / master上工作,另一个团队在SVN上工作。

  • We are using git-svn on the svn repo. 我们在svn仓库上使用git-svn。
  • I could merge svn/trunk into git/master but this would terribly awful. 我可以将svn/trunk合并到git/master但这太可怕了。 So I prefer to push all the commits after c75e75c into the branch/app_v2 所以我更喜欢将c75e75c之后的所有提交推送到branch/app_v2
  • The git/branch is simply a copy of svn/trunk after commit c75e75c. git / branch只是提交c75e75c之后的svn / trunk的副本。

在此处输入图片说明

Tried with git push <remotename> <commit SHA>:<remotebranchname> How can I pushing specific commit to a remote, and not the previous commits? 尝试过git push <remotename> <commit SHA>:<remotebranchname> 如何将特定的提交推送到远程而不是先前的提交? . I created a remote branch/app_v2. 我创建了一个远程分支/ app_v2。 But the commits SHA on git-svn and git repo are not the same. 但是对git-svn和git repo的提交SHA是不一样的。 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 ) ? 如何推送一系列提交(在c75e75c和HEAD之间)并推送到远程分支(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存储库上 ,创建远程分支(请注意,它与SVN的c75e75c版本相同,但在另一个git存储库上没有相同的名称)

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 在SVN repo上 ,回滚到修订版本以进行推送

git checkout c75e75c

push to the remote branch 推送到远程分支

git push origin <current_locale_branch>:<branch_name> 

Any questions ? 任何问题 ?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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