我最近一直在阅读 git rebase 并想自己测试一下,但我遇到了一个错误,所以现在我在质疑我的理解。如果你能帮助我纠正我的理解,那就太好了。首先我得到的错误是:
fatal: Needed a single revision
invalid upstream 'ABC-test1'
在本地我有一个分支 ABC-test1
。我从 ABC-test1
创建了一个分支,并使用 ABC-test2
将其命名为 git checkout -b ABC-test2 ABC-test1
。
然后我创建了一个文件 rebase1.py
,其中包含来自 ABC-test1
的一些内容。然后我还创建了一个名为 rebase1.py
的文件,其中包含分支 ABC-test2
中的一些内容,与添加到 rebase1.py
的内容不同。我的理解是,在这种情况下,我认为 ABC-test1
image1 中的 master
分支和 ABC-test2
image1 中的 topic
分支。
当我运行 git rebase ABC-test1 ABC-test2
时,我希望看到与图像 2 等效的内容,这样我的 ABC-test2
应该包含来自 ABC-test1
的所有内容。即,rebase1.py
中的 ABC-test2
应包含 ABC-test1
和 ABC-test2
形式的所有内容。
我的理解有什么问题?