简体   繁体   English

将新的 github repo 合并到远程

[英]merge new github repo into remote

I am trying to merge commits from branch B to branch A.我正在尝试将提交从分支 B 合并到分支 A。

branch A has commits a-c 
branch B has commits d-f BUT doesn't have commits a-c in it's commit history.

How can I get branch B's commits df to show in branch A after commit c.如何在提交 c 后让分支 B 的提交 df 显示在分支 A 中。

I tried git cherry-pick hashCommit but I got a message saying我试过git cherry-pick hashCommit但我收到一条消息说

The previous cherry-pick is now empty, possibly due to conflict resolution.
If you wish to commit it anyway, use:

    git commit --allow-empty

Otherwise, please use 'git reset'

I also checked out this SO post , but wasn't sure which Answer was suitable for me.我还查看了这篇 SO 帖子,但不确定哪个答案适合我。

When I look in my github pages branch B, at the top it say branch B is x commits ahead of branch A当我查看我的 github pages 分支 B 时,在顶部它说分支 B 是 x 在分支 A 之前提交

在此处输入图片说明

Also after doing the cherry-pick , when I type git log, the first commit shows同样在执行cherry-pick ,当我输入git log时,第一次提交显示

commit hashCommitNumber (HEAD -> branchB, origin/branchB, branchA)

I am currently checked out on branch B我目前在 B 分行结账

What I did was I migrated the RTC histories from the last successful cut off date to the present date我所做的是将 RTC 历史从上次成功截止日期迁移到当前日期

It depends on how/where that migration was made: if it is in a new repo/new branch, then yes, a merge would be difficult (unrelated history)这取决于迁移的方式/地点:如果它在新的回购/新分支中,那么是的,合并将很困难(不相关的历史)

A better practice is:更好的做法是:

  • having a local clone of your GitHub repository, set on the branch you want to update with RTC new changesets拥有 GitHub 存储库的本地克隆,设置在要使用 RTC 新变更集更新的分支上
  • having a local RTC repository workspace (sandbox)拥有本地 RTC 存储库工作区(沙箱)
  • iterate on each changeset and update your sandbox 迭代每个变更集并更新您的沙箱
  • use git --work-tree=/path/to/sandbox add .使用git --work-tree=/path/to/sandbox add . (done inside your local Git clone). (在本地 Git 克隆中完成)。 That will detect any new/changed/removed file from sandbox compared to your current Git repository content与您当前的 Git 存储库内容相比,这将检测沙箱中的任何新的/更改的/删除的文件
  • commit, and repeat for the next changeset.提交,并为下一个变更集重复。

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

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