git-提交并推动本地更改而不会丢失文件差异?
我在vscode
中,只是对我的分支进行了大量更改。由于没有在线备份,我有一个粗略的草稿,这将是可耻的。因此,自然而然的是,我的更改是很聪明的。
但是这样做将删除我所有的文件差异,即Visual Studio Code
的界面在侧边栏中显示我(请参见下图)。有什么方法可以推到远程分支,但仍然可以将更改保持未分布(或将它们带回尚未分布),或者至少保持这些差异文件的任何方法看到我触摸的地方?
I'm in VSCode
and just made a ton of changes on my branch. I have a rough draft that would be a shame to lose due to to not backing up online. So naturally it would be smart to git add .
my changes, then git push origin myBranch
to create a remote backup.
But doing so will remove all my file diffs that Visual Studio Code
's interface shows me in the sidebar (see picture below). Is there a way I can push to a remote branch but still keep the changes unstaged (or bring them back to unstaged), or any way to at least keep those diff files so I can still continue work on my local and easily be able to see everywhere that I touched?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您进行提交并将其推动以进行远程备份。
然后,您将其分支在本地丢弃,
您将分支放在上一个提交上,并在文件中留下所有更改,以便您可以看到diffs。
请注意,稍后您必须在完成本地提交后的稍后将您的分支强加。根据如何设置远程存储库,这可能不是问题。
You make a commit and push it to make the remote backup.
Then you discard the commit locally with
This points your branch to the previous commit and leaves all changes in the files so that you can see the diffs.
Be aware that you will have to force-push your branch later on when you have finished your local commits. That may or may not be a problem depending on how your remote repository is set up.
如果您没有任何更改,您会推出什么?
简单的解决方案是。保留您进行更改的所有文件,然后撤消更改。
以后您可以参考复制文件的更改
what will you push if you don't have any changes?
simple solution will be . keep a copy all the files that you have made changes, then undo changes.
later you can refer to the changes from copied files
通过使用
git stash
保存您的工作。推动承诺的更改后,您可以将“无需更改”称为git stash pop
。请参阅文档在这里save your work by using
git stash
. after pushing committed changes then you can call uncommitted changes asgit stash pop
. see the documentation here