我如何从我的“公众”中获取信息? git 服务器将我损坏的本地“master”带到最新?
我有一个本地“主”git 存储库。每隔几个小时,我就会将更改“git Push”到服务器,然后从服务器拉取到客户端计算机。好吧,我不小心使用 GITK 将我的本地“主”存储库回滚了一个版本。
从服务器拉回最后提交的版本并且仍然让我的本地版本表现得“出色”的步骤是什么?
I have a local "master" git repository. Every few hours, I 'git push' my changes to a server from which I then pull to my client machines. Well, I accidentally used GITK to rollback my local "master" repository one version too far.
What are the steps to pull the last committed version back from the server and still have my local version behave "masterfully"?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
假设您的本地 master 仍然是干净的,即,没有本地更改,但服务器存储库上 master 后面有一些提交,您只需从中提取:
在上面的命令中,
server< /code> 是其他客户端从中提取的远程名称(或者您可以使用其 URL)。
Assuming your local master is still clean, i.e., no local changes, but some number of commits behind master on the server repo, you need only pull from it:
In the above command,
server
is the name of the remote that other clients pull from (or you could use its URL instead).首先,存储现有的更改:
然后,运行(考虑到您要更新本地存储库的远程名称为
origin
):应用存储的更改:
First, stash your existing changes:
Then, run (considering that the remote from which you want to update your local repository to be named
origin
):Apply the stashed changes: