如何压缩所有提交而不丢失子模块? [英] How do I squash all commits without losing submodules?
问题描述
我喜欢如何将所有git提交压缩为一个?。
但是,如果我发现合并冲突:
git rebase --root -i
按照建议的选择和压扁。
而且,我失去了我的子模块(我有5),当我
rm -rf .git
git init
git add。
最有效的方法是压缩所有历史记录并将子模块保留在其当前目录中 code> git commit --amend
第一个命令将当前分支重置为第一次提交,但保留当前索引和第二个命令提交上次提交中的当前索引。
I like the answers from How to squash all git commits into one?.
However, I get merge conflicts if I:
git rebase --root -i
with pick and squash as suggested.
And, I lose my submodules (I have 5), when I
rm -rf .git
git init
git add .
What is the most effective way to squash all history and keep my submodules in their current directories at their current sha.
Try git reset --soft SHAOFFIRSTCOMMIT
and then git commit --amend
The first command resets the current branch to the first commit, but keepsmthe current index and the second command commits the current index in the last commit.
这篇关于如何压缩所有提交而不丢失子模块?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!