使用Git一起壓縮我的最后一個X如何使用Git將最后一個X提交壓縮為一個提交?
3 回答
慕沐林林
TA貢獻2016條經驗 獲得超9個贊
git rebasegit merge --squash
git reset --soft HEAD~3 && git commit
git rebase -igit commit:
git reset --soft HEAD~3 &&
git commit --edit -m"$(git log --format=%B --reverse HEAD..HEAD@{1})"
翻閱古今
TA貢獻1780條經驗 獲得超5個贊
git merge --squashgit rebase -i
git statusgit reset --hard
# Reset the current branch to the commit just before the last 12:
git reset --hard HEAD~12
# HEAD@{1} is where the branch was just before the previous command.
# This command sets the state of the index to be as it would just
# after a merge from that commit:
git merge --squash HEAD@{1}
# Commit those squashed changes. The commit message will be helpfully
# prepopulated with the commit messages of all the squashed commits:
git commitgit merge--squash
最新情況:git reset --soft HEAD~12 && git commit
- 3 回答
- 0 關注
- 616 瀏覽
添加回答
舉報
0/150
提交
取消
