简体   繁体   English

在我对VS 2017进行最新更改之后,是否对分支或git repo进行了任何更改之后,有没有回去的方法?

[英]Is there a way to go back, after I have pulled latest changes on my VS 2017, without making any changes to the branch or git repo?

My mentor and I are both working on a project in Visual Studio 2017 -directly in the master branch. 我和我的导师都在Visual Studio 2017中直接在master分支中从事项目。 (using GitHub for Visual Studio extension). (使用GitHub进行Visual Studio扩展)。

I recently pulled in his changes (3 commits) but now i want to go back to the state I was in, before pulling the changes. 我最近提取了他的更改(3次提交),但现在我想回到我所处的状态,然后再进行更改。

I searched about git revert, git reset etc. but they seem to make changes to the branch in git. 我搜索了有关git revert,git reset等的信息,但是它们似乎对git中的分支进行了更改。

I want to go back to the previous version of my code - only on my local machine, without disturbing the repository on GitHub. 我想回到我的代码的先前版本-仅在我的本地机器上,而不打扰GitHub上的存储库。 Any way to restore the code to a certain point in the tree, locally, without changing the tree itself? 有什么方法可以将代码本地还原到树中的特定点,而无需更改树本身?

I do not hold much experience in this, Thanks. 我对此没有太多经验,谢谢。

Your question does not provide enough information of the purpose of 'restoring the code to a certain point'. 您的问题没有提供足够的信息来说明“将代码还原到特定点”。

  • if that is just temporary to test a specific behavior or see the look of the code, have a look at git checkout <sha1_of_a_commit> . 如果这只是测试特定行为的临时功能或查看代码外观,请查看git checkout <sha1_of_a_commit>

And when you've finished, don't forget to return to the master branch with git checkout master 完成后,别忘了使用git checkout master返回主分支。

  • if that's because you realized that didn't want to pull the commits from the remote, do a git reset --hard <sha1_of_a_commit> after taking care of having stashed all the uncommitted changes. 如果那是因为您意识到不想从远程拉出提交,请在git reset --hard <sha1_of_a_commit>所有未提交的更改之后执行git reset --hard <sha1_of_a_commit>

And don't be afraid, you can't mess the remote commits until you 'force pushed' which is not advised until you understand what you are doing! 并且不要害怕,除非您“强行推动”,否则您不可以弄乱远程提交,除非您了解自己在做什么,否则不建议这样做!

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在Eclipse中,我成功地从Git中提取了我的代码,但是我可以看到“&gt;”而无需对本地目录进行任何更改 - In Eclipse I was successfully pulled my Code from Git, but I could See “>” without making any changes to my Local directory 我 git 被拉出而不保存在本地 repo 上所做的更改 - I git pulled without saving changes made on local repo 在创建新分支后也需要从master到本地本地仓库的git pull安全吗?我也需要在该分支上查看最新更改? - Is it safe to do a git pull from master to my local repo after creating a new branch on which I need to see the latest changes too? 完成“撤消待处理的更改”后,有什么办法可以找回我的更改 - Is there any way to get my changes back after I have done “Undo Pending changes” Git更改不会被拉到本地分支 - Git changes are not pulled on to the local branch 进行更改后派生Git存储库 - Forking Git repo after making changes 在解决 GIT 中的合并冲突时,有什么方法可以获取我所做的最新更改? - Is there any way to get the latest changes that i have done while resolving merge conflicts in GIT? 在 git 中的代码审查后更改分支 - Making changes to branch after code review in git 在进入另一个分支并返回后,我看不到我在 git 分支中所做的文件更改 - I can't see file changes I made in my git branch, after I went in to a different branch and came back 在 git 上没有什么可提交的,但我的分支上有一些更改 - Nothing to commit on git, but I have some changes on my branch
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM