2013-04-10 54 views
1

我有一個項目,其中我的開發分支是2穩定分支之前的標籤發佈,但我想刪除第一個標記的更改集(這是我不再想要的一系列功能),但將最新的標記更改(第二個標記)應用到穩定標記上。Git rebase的標籤,而不是單獨提交

例如:

提交:

[tag] 3.0 - 
sdaf213 Some Commit of the tag 3 
sdaas34 Some other commit in this tag 
[tag] 2.0 - 
wert78 Some commit of tag 2 
werg99 Another commit of tag 2 
werh55 And another of tag 2 
[tag] 1.0 (Stable) - 
pry77 Commits of tag 1 
...older commits 

有沒有辦法與git變基上的標籤,而不是承諾,這樣我可以變基的[標籤頂部[標籤] 3.0的所有提交] 1.0,但排除[標籤] 2.0中的所有內容?

git rebase --onto 1.0 2.0 BRANCH 

哪裏分公司要應用衍合你的分支的名字:

+0

標籤_are_(標識符)提交。您幾乎總是可以使用標籤而不是SHA – Useless 2013-04-10 16:18:13

回答

3

你可以這樣做只是。

這將使用1.0標籤作爲母公司,然後重播3.0標籤的提交順序:

sdaf213 Some Commit of the tag 3 
sdaas34 Some other commit in this tag 
1.0 (Stable) - 
pry77 Commits of tag 1 
...older commits 

正如你可以看到3.0標籤將不會被重新應用到您的歷史結束。你將不得不創建一個新的,雖然這是有道理的,因爲歷史已經改變,你可能想要使這個2.1或3.1,以滿足您的需求。

此外,你可以通過一系列標籤來使用它。例如,如果您現在在[tag] 4.0並且想要擺脫[tag] 2.0和3.0:

git rebase --onto 1.0 3.0 BRANCH