Git merge master into feature branch

后端 未结 11 702
既然无缘
既然无缘 2020-11-27 08:56

Let’s say we have the following situation in Git:

  1. A created repository:

    mkdir GitTest2
    cd GitTest2
    git init
    
  2. Some m

11条回答
  •  隐瞒了意图╮
    2020-11-27 09:09

    Zimi's answer describes this process generally. Here are the specifics:

    1. Create and switch to a new branch. Make sure the new branch is based on master so it will include the recent hotfixes.

      git checkout master
      git branch feature1_new
      git checkout feature1_new
      
      # Or, combined into one command:
      git checkout -b feature1_new master
      
    2. After switching to the new branch, merge the changes from your existing feature branch. This will add your commits without duplicating the hotfix commits.

      git merge feature1
      
    3. On the new branch, resolve any conflicts between your feature and the master branch.

    Done! Now use the new branch to continue to develop your feature.

提交回复
热议问题