简体   繁体   中英

How do I squash all commits without losing submodules?

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 keeps the current index and the second command commits the current index in the last commit.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM