所以我使用了以下内容:
git checkout --orphan newBranch
git add -A # Add all files and commit them
git commit
git branch -D master # Deletes the master branch
git branch -m master # Rename the current branch to master
Run Code Online (Sandbox Code Playgroud)
这对于 Gitrepo 提交历史记录非常有效,但是,当我使用 gitk --all 时,我仍然可以看到所有先前的提交。是否也可以将所有这些提交合并为一个?
谢谢!
使用git rebase -i --root。然后将除第一行之外的所有行的前缀从 更改pick为squash。所有提交将合并到一个提交中。
当然,当您推送更改时,您需要强制推送,否则它不会推送您的更改。
| 归档时间: |
|
| 查看次数: |
4759 次 |
| 最近记录: |