[英]How can get all commits from branch and put in single commit
I have this 我有这个
A-----1'--2'--3'--4' (master)
\
\
D-----1--2--3--4--5--6--7--8--9 (dev)
what i want get all chnages from D - 9
since diverge from master and then put all in one commit and make new branch dev2
which will have all chnages from dev branch 我想要的是从
D - 9
获取所有更改,因为它们与master背离,然后全部提交并创建新分支dev2
,它将拥有来自dev分支的所有更改
There are 30 commits in there 那里有30个提交
If you already created dev2
from master
branch: 如果您已经从
master
分支创建了dev2
:
A-----1'--2'--3'--4' (master, dev2)
\
\
D-----1--2--3--4--5--6--7--8--9 (dev)
Then you can get all commits from dev
branch into one commit to dev2
by: 然后,您可以通过以下方式将所有提交从
dev
分支提交到dev2
:
git checkout dev2
git merge dev --squash
Now the commit history will be (commit M
is the merge commit which contains all the changes from dev
branch): 现在的提交历史将是(commit
M
是合并提交,其中包含来自dev
分支的所有更改):
(master)
|
A-----1'--2'--3'--4'---M (dev2)
\
\
D-----1--2--3--4--5--6--7--8--9 (dev)
1.从主节点创建分支dev2。获取最新的dev 3.结帐dev2 4.将dev合并到dev2
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.