Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
4.1k views
in Technique[技术] by (71.8m points)

git 修改某个commit 内容

某个commit 中的修改代码遗漏, 如何修改指定commit,如图
image.png

想 修改refactor: api/dmEditor/source/character/static2d
提交内容,不产生新的commit.
好像使用git rebase 后无法执行提交,好像并未找到BCompare

$ git rebase -i bd9a0d8c67ebc9be512bb175ee8713b9179e2216
hint: Waiting for your editor to close the file... error: cannot spawn BCompare: No such file or directory
error: unable to start editor 'BCompare'
git commit --amend
hint: Waiting for your editor to close the file... error: cannot spawn BCompare: No such file or directory
error: unable to start editor 'BCompare'
Please supply the message using either -m or -F option.

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

这种情况,如果还没有推送到远端的话,回退重新提交可以,检出到你要修改的前一个点检出新分支,然后遴选过来你要修改的点不 commit, 然后把你要追加修改的内容加进去,然后 commit, 再把后面的其他点全部遴选过来. 这种情况下你是用 rebase 是要干嘛啊?不太懂?

如果已经推到远端了,本地操作完成之后,需要远端给你覆写这个分支的权限,让你把你本地的变更强推上去.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...