结帐后获取提交的更改
有什么方法可以获取我在签出新分支时留下的未提交的更改(愚蠢,我知道!!)
我切换回了我所在的分支,并且我仍然有以下消息,让我相信它们可能在某个地方我能到!
M app-switcher.tmproj
M as_user_check.php
is there any way to fetch uncommited changes I left when I checkout out a new branch (dumb, I know!!)
I switched back the branch I was on, and I still have the following message, leading me to believe they might be somewhere I can get to!
M app-switcher.tmproj
M as_user_check.php
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您从一个分支切换到另一个分支,并且分支的更改不会影响您在工作树中修改的文件,那么这些文件的工作副本也不会受到影响。您从 git checkout 看到的输出提醒您这一点。
要查看这些文件中未暂存的更改,您只需执行以下操作:
...并且您只需签出要将这些更改提交到的分支,然后
git add
和git commit
像往常一样。一个可能造成混淆的原因是,如果更改已暂存,您将看到相同的输出(带有
M
前缀)。在这种情况下,要查看更改,您必须执行以下操作:在这种情况下,您只需使用
git checkout
切换到正确的分支,并使用git commit
提交这些更改代码>.如果您想取消暂存更改,您可以执行以下操作:...,因为
git status
的输出会提示您。If you switch from one branch to another, and the change of branches wouldn't affect files that you've modified in your working tree, your working copy of those files won't be affected. The output that you see from
git checkout
is reminding you of that.To see the unstaged changes in those files, you can just do:
... and you can just checkout the branch you want to commit those changes to and
git add
andgit commit
as usual.One possible source of confusion is that you'll see the same output (with an
M
prefix) if the changes have been staged. In that case, to see the changes, you'll have to do:In that case, you can just switch to the right branch with
git checkout
and commit those changes withgit commit
. If you want to unstage the changes, you can do:... as the output of
git status
should prompt you.