Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
所以我昨天下午 3:00 签出了一个提交,我想让它成为新的主人,有效地忽略下午 3:00 之后发生的所有提交
我该怎么做呢?
假设您要使新主人的提交具有提交 sha abcdefg,那么您可以使用它(同时master签出您的分支):
abcdefg
master
git reset --hard abcdefg
这会将 for 的分支指针更改为master指向 commit abcdefg,从而有效地使其成为master分支的新顶部提交。
您可以reset在 Git 官方文档中了解更多信息。
reset