gpt4 book ai didi

Git rebase 首先 2 Commit

转载 作者:太空狗 更新时间:2023-10-29 14:44:05 24 4
gpt4 key购买 nike

这是我到目前为止所做的。我要做的是在推送之前将第一次和第二次提交 merge 为一个提交(尚未添加远程存储库)。

$ git init

$ vim myprogram

$ git add myprogram && git commit -m "Initial commit"

$ vim README.md

$ git add README.md && git commit -m "Added readme"

$git log --pretty=oneline
b8e2979 Added readme
a579d65 Initial commit

$ git rebase -i HEAD~2
fatal: Needed a single revision
invalid upstream HEAD~2

我做错了什么导致了 fatal error 。

如果有人问过这个确切的问题,请标记它并提供链接。

最佳答案

您想使用 --root选项:

... Rebase all commits reachable from <branch>, instead of limiting them with an <upstream>. This allows you to rebase the root commit(s) on a branch. ...

git rebase -i --root

关于Git rebase 首先 2 Commit,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39071409/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com