Git重置的實際用途-軟?我和GIT已經工作了一個多月了。事實上,我昨天才第一次使用了重置,但軟復位對我來說仍然沒有多大意義。我知道我可以使用軟重置來編輯提交,而不改變索引或工作目錄,就像我用git commit --amend.這兩個命令真的相同嗎?reset --softVScommit --amend)?有什么理由在實際中使用其中一種或另一種?更重要的是,對于reset --soft除了修改承諾?
3 回答

富國滬深
TA貢獻1790條經驗 獲得超9個贊
用例-組合一系列本地提交
例如:
> git add -A; git commit -m "Start here." > git add -A; git commit -m "One" > git add -A; git commit -m "Two" > git add -A' git commit -m "Three" > git log --oneline --graph -4 --decorate > * da883dc (HEAD, master) Three > * 92d3eb7 Two > * c6e82d3 One > * e1e8042 Start here. > git reset --soft HEAD~3 > git log --oneline --graph -1 --decorate > * e1e8042 Start here.
對你問題的簡短回答
reset --soft
commit --amend
)?
沒有。
commit --amend
從上次提交中添加/rm文件或更改其消息。 reset --soft <commit>
將幾個順序提交合并成一個新的提交。
reset --soft
見其他答案:)
- 3 回答
- 0 關注
- 624 瀏覽
添加回答
舉報
0/150
提交
取消