对主人分支进行恢复和新的更改

发布于 2025-02-10 01:16:42 字数 234 浏览 0 评论 0原文

  • 我已将当前项目的实施的一半用于主部门。
  • 然后,我创建了来自主分支的新功能分支,以实现项目的其余部分。
  • 由于有紧急版本,我已经从主分支中恢复了部分实现,同时将这些更改保留在我的功能分支中。
  • 在恢复了我的更改后,其他开发人员为主分支添加了新的承诺。
  • 现在,主分支上也很少有新的提交,我的功能分支机构上没有可用的,

我现在应该如何对主分支进行更改?

  • I had committed half of the implementation of my current project to master branch.
  • Then I created new feature branch from master branch to implement rest of the implementation of the project.
  • Since there was an urgent release I have reverted partial implementation from master branch while keeping those changes in my feature branch.
  • After reverting my changes, other developer has added new commits to master branch.
  • Now there are few new commits also available on master branch which are not available on my feature branch

How should I commit my changes to master branch now?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

温暖的光 2025-02-17 01:16:42

从点开始一个新的温度分支 的半实践提交。樱桃从主机上挑选了每个半实施的每一个实施,都可以在这个新的临时分支上。现在,将您的功能分支从主分支开始,从主分裂到临时分支。

现在,您将有一些准备合并为主人的东西。

示例:假设我们已经说

A B F1 F2 REVERT X Y Z (master)
         \
          F3 F4 (feature)

,您会说

git switch --det B
git switch -c temp
git cherry-pick F1
git cherry-pick F2
git rebase --onto temp F2 feature

结果

A B F1 F2 REVERT X Y Z (master)
   \      
    F1' F2' F3' F4' (feature)

现在是由F1 F2 F3 F4的副本组成的,它准确地表达了您的功能历史记录,并且可以合并为主。

Start a new temp branch from the point before the first of the half-implementation commits. Cherry pick each of the half-implementation commits from master onto this new temp branch. Now rebase your feature branch, starting where it split from master, onto the temp branch.

Now you will have something ready to merge into master.

Example: suppose we have

A B F1 F2 REVERT X Y Z (master)
         \
          F3 F4 (feature)

Then you would say

git switch --det B
git switch -c temp
git cherry-pick F1
git cherry-pick F2
git rebase --onto temp F2 feature

The result is

A B F1 F2 REVERT X Y Z (master)
   \      
    F1' F2' F3' F4' (feature)

Now feature consists of copies of F1 F2 F3 F4, expressing exactly the history of your feature, and it is ready to merge into master.

洒一地阳光 2025-02-17 01:16:42

您也可以从主分支中拉出进行的更改,然后合并并与现有分支,同步并推回主分支。

You can also pull from the master branch for the changes made then merge and compare with your existing branch , sync and push back into master branch.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文