我試圖從多個提交(它已被推送到起源/主)作出一個提交。GIT rebase - 多個提交到一個 - 仍在歷史中看到
我從本教程嘗試它: https://feeding.cloud.geek.nz/posts/combining-multiple-commits-into-one/
$ git log --oneline
c172641 Fix second file
24f5ad2 Another file
97c9d7d Add first file
we can combine the last two commits (c172641 and 24f5ad2) by rebasing up to the first commit:
$ git rebase -i 97c9d7d
and specify the following commands in the interactive rebase screen:
pick 24f5ad2 Another file
squash c172641 Fix second file
which will rewrite the history into this:
$ git log --oneline
1a9d5e4 Another file
97c9d7d Add first file
這工作不錯,直到我把它推到原點/主。
$ git pull
$ git push origin master
$ git log --oneline
RESULT IS:
******* Merge branch master...
******* THAT REBASE name...
c172641 Fix second file
24f5ad2 Another file
97c9d7d Add first file
但我想這樣的結果:
$ git log --oneline
1a9d5e4 Another file
97c9d7d Add first file
這可能嗎?
從「一隻狗」獲取幫助:運行'git log --all --decorate --oneline --graph'。合併後,您可以省略「全部」部分。請記住,*從不使用'git pull' *,首先使用'git fetch',然後使用DOG,*然後*合併*如果* DOG說它沒問題。 :-) – torek