我的 git 对象图如下所示。我想将提交、、、2fb14b7
和39224ad
压缩fe9252d
到3e7a060
一个提交中。
* 650c464 (temp) adding hw2.txt
| * dd3674a (master) added hw3
| | * 8dc0857 (FIX_REVIEW_COMMENTS) added hwa
| |/
| * c39d943 hw2 added in master
| | * e2a1c13 (HEAD, refs/stash, trying_to_squash) WIP on temp: 2fb14b7 hw7
| | |\
| | | * 429b1de index on temp: 2fb14b7 added hw7
| | |/
| | * 2fb14b7 <-- added hw7
| | * 39224ad <-- (another_branch) added hw3
| | * fe9252d <-- hw2 added in master
| | * 3e7a060 <-- adding hw2.txt
| |/
|/|
* | ba55177 (old_fixes) added hw4
|/
* a1ede1f added another hello world to hw1
* 2ea750a added hw1
以下是我尝试过的(但不明白为什么它不起作用)。
Q1。为什么这不是壁球?
$ git checkout 2fb14b7 -b try_to_commit
$ git merge --squash 3e7a060
(nothing to squash)Already up-to-date.
$
Q2。这对我的存储库有什么影响?
$ git rebase --interactive 3e7a060
$ # I choose pick for the first commit object, and squash for the rest
$ # but somehow this complicates my repository graph even more!