Git: How to squash all commits on branch

前端 未结 13 1926
情深已故
情深已故 2020-12-04 04:33

I make new branch from master with:

git checkout -b testbranch

I make 20 commits into it.

Now I want to squash those

13条回答
  •  伪装坚强ぢ
    2020-12-04 04:45

    Another solution would be to save all commit logs to a file

    git log > branch.log

    Now branch.log will have all commit ids since beginning.. scroll down and take the first commit (this will be difficult in terminal) using the first commit

    git reset --soft

    all commits will be squashed

提交回复
热议问题