简体   繁体   English

我如何退出我所做但尚未在我的 GITHUB 分支中提交的一些更改

[英]How can I back out of some changes I made but didn't yet commit in my GITHUB branch

Here's the output from > git status这是> git status 的输出

MacBook:Ja.git alan$ git status
On branch alan-1
Your branch is up to date with 'origin/alan-1'.

Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)

    modified:   Ja/App/App.xaml.cs

no changes added to commit (use "git add" and/or "git commit -a")
MacBook:Ja.git alan$ 

I made changes to the App.xaml.cs but didn't yet commit.我对 App.xaml.cs 进行了更改,但尚未提交。

Not sure if it makes any difference but I am using Visual Studio as my front-end and I also have access to git on the command line.不确定它是否有任何区别,但我使用 Visual Studio 作为我的前端,我也可以在命令行上访问 git。

How can I back out of the changes that I made and restore App.xaml.cs to the way it was before I edited it?如何退出我所做的更改并将 App.xaml.cs 恢复到我编辑它之前的状态?

Can I do it from the Visual Studio menu here:我可以从这里的 Visual Studio 菜单执行此操作吗:

在此处输入图片说明

How can I back out of the changes that I made and restore App.xaml.cs to the way it was before I edited it?如何退出我所做的更改并将 App.xaml.cs 恢复到我编辑它之前的状态?

Yes, git checkout -- filename has the same effect as "revert" command from the menu.是的, git checkout -- filename与菜单中的“revert”命令具有相同的效果。

Instead of going to main menu, you can also locate the Changes window in Visual Studio (Team Explorer --> Changes) and revert from there.除了转到主菜单,您还可以在 Visual Studio(团队资源管理器 --> 更改)中找到“更改”窗口并从那里恢复。

暂无
暂无

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

相关问题 我对许多文件进行了更改,但尚未提交。 我如何撤出所有更改? - I made changes to a lot of files but didn't yet do a commit. How can I back out of all the changes? 我在错误的分支上进行了更改。 我还没有承诺。 如何将我的更改提交到预期的分支? - I made changes while on the wrong branch. I haven't committed yet. How do commit my changes to the intended branch? GitHub 在我的分支中发生了我没有做的更改 - GitHub has changes in my branch that I didn't do 如何在我的 git 分支中挑选一些提交? - How can I pick out some commit in my git branch? 在进入另一个分支并返回后,我看不到我在 git 分支中所做的文件更改 - I can't see file changes I made in my git branch, after I went in to a different branch and came back 当我已经进行了一些更改时如何更新我的分支 - How to update my branch when I already made some changes 如何检索在github上对本地存储库的提交? - How can I retrieve a commit made on github to my local repo? 如果我想签出到另一个分支但我还不想提交,如何保留更改? - How to keep changes if I want to checkout to another branch but I don't want to commit yet? 如何恢复在本地删除但尚未提交的文件? - How can I recover files I deleted locally but didn't yet commit? 在Github中,如何将上游分支回滚到原始分支当前指向的提交? - In Github, how do I rollback upstream branch back to the commit to which my origin branch is currently pointing?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM