search

Home  >  Q&A  >  body text

git合并产生的一些问题,如何放弃当前衍生,直接指向其他分支的内容

目前我的项目是这个样子的

有四个分支

master、release、develop、feature

master发布正式版

release发布测试版

develop用来开发

feature是从develop分出来做一个补救功能的,这个测试功能需要发布到线上,等develop原本功能成熟了,再将其删除

feature不会合并到develop中去

请问

当develop的功能成熟后,将develop向release分支中合并时,如何丢弃release分支中所有feature分支的内容?

是否有方法将release直接指向develop的最新内容?

伊谢尔伦伊谢尔伦2794 days ago538

reply all(1)I'll reply

  • 仅有的幸福

    仅有的幸福2017-05-02 09:22:20

    Thanks for the invitation!
    First: I think your management is unreasonable. The feature branch is merged into the release branch, and then you want to remove the merged content of the feature branch later.

    On this point, I think you can re-open a branch releasetmp from the release branch to merge the feature branch. When the develop branch matures and is merged into the release branch, then releasetmp can be deleted.

    Second: Regarding your problem, if you want to delete the contents of the feature branch, you can roll back to the last commit hash position before merging the feature branch.

    Try it, I don’t know if it will work. The idea is probably to roll back.

    git revert commithash
    

    Referencehttp://yijiebuyi.com/blog/8f985d539566d0bf3b804df6be4e0c90.htmlhttp://yijiebuyi.com/blog/8f985d539566d0bf3b804df6be4e0c90.html
    http://samael65535.github.io/git/2013/01/18/git/http://samael65535.github.io/git/2013/01/18/git/

    reply
    0
  • Cancelreply