git VSCode“请在结帐前清理您的存储库工作树”

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/51817479/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-09 05:20:16  来源:igfitidea点击:

VSCode "please clean your repository working tree before checkout"

gitvisual-studio-code

提问by hacking_mike

In Visual Studio Code I made some changes which I do not want to commit en sync yet. However, after my holiday, I want to sync the files from the server (changes from my colleagues). So In Visual Studio Code I want to do a sync.

在 Visual Studio Code 中,我做了一些我不想提交同步的更改。但是,假期结束后,我想从服务器同步文件(来自同事的更改)。所以在 Visual Studio Code 中我想做一个同步。

I get a message "Please clean your repository working tree before checkout"

我收到一条消息“请在结帐前清理您的存储库工作树”

What do I need to do to get the files of my colleagues without losing my own uncommitted changes?

我需要做什么才能在不丢失自己未提交的更改的情况下获取同事的文件?

回答by Eimantas

Create a temporary branch and commit the changes. Or if you don't want to create a temporary branch - stash the changes.

创建一个临时分支并提交更改。或者,如果您不想创建临时分支 - 隐藏更改。

回答by ddavidad

In my experience the best way to is to stash the changes like so: stash

根据我的经验,最好的方法是像这样隐藏更改:stash

sync the changes from your co-workers and afterwards do stash-pop like so: stash pop

同步来自同事的更改,然后像这样执行 stash-pop: stash pop

You may also perform these actions in the terminal: git stashgit stash pop

您也可以在终端中执行这些操作: git stash git stash pop