dougua3706 2014-10-17 13:34
浏览 64

使用git进行两个分支

think I am going to use these three files in Master Branch

MASTER :

index.php

  <b>hello</b>

test.php
img.jpeg

now I create a branch from Master

NewBranch :

index.php

     <b>hello</b>

test.php
img.jpeg

and now I will edit Master index.php file, and I will add two lines of code to master branch

MASTER :

index.php

  <b>hello</b>
  <a>test</a>
  <p>good</p>     

and I will change some code in NewBranch

NewBranch :

index.php

     <b>hello</b>
     <div>this is new branch line</div> 

I want to update NewBranch so I will have my own edited lines on New Branch and also updated lines on Master Branch

NewBranch : (should be like as below)

index.php

     <b>hello</b>
     <div>this is new branch line</div>
     <a>test</a>
     <p>good</p>  

How can I achieve that? I have used netbeans Pull and Fetch, but did not worked. I also do not want to use git submodule ( as I do not have separate folder )

  • 写回答

2条回答 默认 最新

  • douhuiwan5141 2014-10-17 14:00
    关注
    1. You changes on both the branches should be "committed". Only changing will do no good.
    2. Then you can rebase your NewBranch over master (git rebase master NewBranch)
    3. Now you new branch has changes of itself and that of master. But master will have only its changes.

    For more details on rebase please refer this.

    评论

报告相同问题?

悬赏问题

  • ¥15 划分vlan后,链路不通了?
  • ¥20 求各位懂行的人,注册表能不能看到usb使用得具体信息,干了什么,传输了什么数据
  • ¥15 个人网站被恶意大量访问,怎么办
  • ¥15 Vue3 大型图片数据拖动排序
  • ¥15 Centos / PETGEM
  • ¥15 划分vlan后不通了
  • ¥20 用雷电模拟器安装百达屋apk一直闪退
  • ¥15 算能科技20240506咨询(拒绝大模型回答)
  • ¥15 自适应 AR 模型 参数估计Matlab程序
  • ¥100 角动量包络面如何用MATLAB绘制