当'test'是'dev'的一个分支时,如何将'test'分支变成'master'?

时间:2022-12-12 13:12:40

Looking at the network graph for a github project, I see 3 branches of interest; master, test, dev.

查看github项目的网络图,我看到了3个感兴趣的分支;主人,测试,开发

Looking at the github network graph further, I am led to believe that test is a branch of dev instead of a branch from master.

进一步查看github网络图,我被认为测试是dev的一个分支而不是master的分支。

At some point, I will want to put the contents of test into master.

在某些时候,我想把测试的内容放到master中。

Will I need to delete master and create a new branch called master from test in order to "get" test into master? By the way, I would like to keep the master history so I can roll back to an earlier commit if needed. So, deleting sounds bad.

我是否需要删除master并从test中创建一个名为master的新分支才能“测试”到master?顺便说一下,我想保留主历史记录,以便在需要时可以回滚到先前的提交。所以,删除声音很糟糕。

1 个解决方案

#1


2  

You should just merge test into master then.

你应该将test合并到master中。

$ git checkout master
$ git merge test

A statement like "test is a branch of dev instead of a branch of master" isn't really true wit Git. test might have branched off of commits from dev, but assuming that dev branched off of master at some point, then by the transitive property test branched off of master too.

像Git这样的声明,“测试是开发的一个分支而不是主人的分支”并不是真的。测试可能已经脱离了dev的提交,但是假设dev在某个时候从master分支出来,那么也可以通过传递属性测试从master中分支出来。

#1


2  

You should just merge test into master then.

你应该将test合并到master中。

$ git checkout master
$ git merge test

A statement like "test is a branch of dev instead of a branch of master" isn't really true wit Git. test might have branched off of commits from dev, but assuming that dev branched off of master at some point, then by the transitive property test branched off of master too.

像Git这样的声明,“测试是开发的一个分支而不是主人的分支”并不是真的。测试可能已经脱离了dev的提交,但是假设dev在某个时候从master分支出来,那么也可以通过传递属性测试从master中分支出来。