使用 git 如何合并已经合并的存储库?

发布于 2024-09-09 20:17:27 字数 132 浏览 1 评论 0原文

我有一个已提取更改的存储库,因此现在它已与远程存储库保持同步。只是现在我意识到我需要提取所有存储库更改并且不保留我的任何更改。我想回顾历史,这样当我拉动时我就不会得到“已经是最新的”。还有第二部分,我怎样才能拉动并获取他们的所有更改而不保留我的更改?

I have a repository that i pulled the changes for, so now it is up to date with the remote repository. Except that now i realized that i needed to pull all of that repositories changes and keep none of mine. I want to go back in history so that i won't get an "Already up-to-date" when i pull. Also part two, how can i pull and get all of their changes keeping none of mine?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

∞觅青森が 2024-09-16 20:17:27
git reset --hard origin/otherbranchname

假设:您位于要移动的分支上,远程称为原点,并且您确实想清除所有提交。

git reset 移动分支指针。该命令只是将其从当前位置取出并将其放置在遥控器的分支指针处,同时更改所有工作副本文件。

git reset --hard origin/otherbranchname

Assumes: You are on the branch you want to move, the remote is called origin, and you really want to blow away all of your commits.

git reset moves branch pointers around. This command simply plucks it from its current location and places it at the remotes' branch pointer, while changing all of the working copy files.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文