我有一個本地分支,我們正在使用pull請求的git-flow,並且在收到PR反饋後,我正在尋找一些提交。如何擠壓我的git分支提交到同一分支沒有rebasing?
如何將我的所有提交(例如PR)提交到同一分支?
我想這會是這樣的:
git checkout master # For master
git pull # Get all branches up-to-date
git checkout feature1 # Checkout the branch
git checkout -b feature1_squash # Make a copy of the branch
git branch -D feature1 # Delete original branch
git checkout master # (?) Branch off latest master for safety
git checkout -b feature1 # Make new (empty) original branch
git merge --squash feature1_squash # Merge with squash into it
git push -f feature1 # Push, force will be required
,但我不知道。
有了這麼多的步驟,它似乎也是一個很好的例子,使用一個函數將它們結合在一起,並將分支名稱作爲參數傳遞。當然,自動化將意味着要確保處理錯誤,例外情況,邊緣情況等。
我不想使用交互式底座,因爲對於我培訓的新手來說有點棘手。我也不想知道提交的數量,我只想做這個分支上存在的所有提交。
我不明白你想要什麼。你有幾個分支,每個分支有不同的提交,你想把它們全部放在一個分支上,這樣就失去了發展歷史? – houtanb
我有1個分支('feature1')與幾個提交,我希望有1個提交。 –