简体   繁体   English

使用EGit Eclipse时出现分支问题

[英]Branch issue when using EGit Eclipse

I have master branch of the project. 我有该项目的主分支。 Then I want to add a new feature so I create a new branch called "new_feature", base on master branch. 然后,我想添加一个新功能,以便在master分支的基础上创建一个名为“ new_feature”的新分支。 In new_feature branch, everything works fine and I want to delete some files that are no longer useful. 在new_feature分支中,一切正常,我想删除一些不再有用的文件。 But when I switch back to master branch and merge with new_feature branch, these deleted files still exist. 但是,当我切换回master分支并与new_feature分支合并时,这些已删除的文件仍然存在。 Here is my question: what I have to do to make master branch is exactly the same as the new_feature branch so I can delete new_feature branch. 这是我的问题:做master分支所要做的与new_feature分支完全相同,因此我可以删除new_feature分支。 Thanks in advance! 提前致谢!

You need merge new_feature branch to master . 您需要将new_feature分支合并到master

The steps are, 步骤是,

  1. Switch to master branch 切换到master分支
  2. Team - Merge, select new_feature branch 团队-合并,选择new_feature分支

@Duc Le: You must merge your new_feature branch to your master branch to get all modified file in new_feature branch into master branch. @Duc Le:您必须将new_feature分支合并到master分支,以将new_feature分支中的所有修改文件都转换master分支。

Maybe something like this you can follow : 也许可以这样:

  1. Check your branch : 检查您的分支:

    $ git branch $ git分支
    new_feature * (your active branch) new_feature *(您的活动分支)
    master

  2. Switch to your master branch : 切换到您的master分支:

    $ git checkout master $ git checkout master

  3. Merge your new_feature to master branch without fast-forward mode: 在没有快进模式的情况下将new_feature合并到master分支:

    $ git merge --no-ff new_feature $ git merge --no-ff new_feature

Explanation about merging without fast-forward 关于不进行快速合并的说明

Sounds like you forgot to check in the delete. 听起来您忘记了签入删除内容。 In Eclipse, switch to the feature branch and open the Git Staging view to see changes that are still pending. 在Eclipse中,切换到功能分支并打开Git Staging视图以查看仍在进行的更改。 File deletes get staged automatically, but not committed . 文件删除都会自动上演 ,但尚未提交

Required sequence is 所需顺序为

Delete - commit - push - checkout other branch - merge - commit - push 删除-提交-推送-签出其他分支-合并-提交-推送

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

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