英文:
How to squash commits with colleagues commits in-between?
问题
我有一个分支,我在那里工作了几周。有时候我回到主分支上,去处理其他功能,然后再回到我的分支。
在这个过程中,我会执行 git fetch
然后在我的分支上执行 git merge
以保持最新。
问题是:我实际上有 46 个提交
,我想要将它们 合并
,但我的同事的提交也在其中。
我怎样才能在我的个人分支上将所有我的个人提交进行 合并
?
当我执行 git log
时,我能看到我的提交,但也能看到所有人的提交。
英文:
I have a branch where I work since few weeks. Sometimes I go back on main to work on other features, and then come back to my branch.
While doing this, I git fetch
and then git merge
in my branch to stay up to date.
Problem : I have actualy 46 commits
that I want to squash
but I have my colleagues's commits in between.
How can I squash
all my personal commits on my personal branch ?
When I git log
, i see my commits but also everyone's commits.
答案1
得分: 1
我使用了git rebase -i HEAD~<提交数量>
,它列出了只有我的提交。只需压缩它们即可。
感谢您在评论中的帮助。
英文:
Posting the solution in case it helps :
i used git rebase -i HEAD~<number of commits>
and it listed only MY commits. Just had to squash then.
Thanks for your help in comments.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论