git 如何在 Github Desktop 中运行 stash?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/44014775/
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 04:58:28  来源:igfitidea点击:

How to run stash in Github Desktop?

gitgithubgithub-for-windows

提问by fatherazrael

How do you run stash in GitHub Desktop on Windows?

如何在 Windows 上的 GitHub Desktop 中运行 stash?

The feature is available in Sourcetree but I'm unable to find it in GitHub Desktop.

该功能在 Sourcetree 中可用,但我无法在 GitHub Desktop 中找到它。

回答by Andrew

GitHub Desktop for Windows doesn't support stash. The only stash-like feature it has is that it will allow you to switch branches if you have uncommited changes. Source

GitHub Desktop for Windows 不支持存储。它唯一的类似 stash 的功能是,如果您有未提交的更改,它将允许您切换分支。来源

Update:GitHub Desktop V2.0.0 now supports stash (Issue 6107).Now when switching branches, you'll be prompted to either leave your changes on the current branch (stash) or bring your changes over to the other branch.

更新:GitHub Desktop V2.0.0 现在支持 stash (问题 6107)。现在,在切换分支时,系统会提示您将更改保留在当前分支(stash)上,或者将更改转移到另一个分支。

回答by Firestar9114

I realize this question is a bit old, and Andrew is correct, but I would like to point out that GitHub Desktop does at least provide a shortcut to a command prompt via Repository>Open in Command Promptwhich you can then use to execute git stashthrough the traditional git CLI commands. Still, frustrating that GitHub Desktop doesn't provide a clean way to do this via their GUI, forcing you to fallback to git CLI tools for stashing.

我意识到这个问题有点老了,Andrew 是正确的,但我想指出 GitHub Desktop 至少提供了命令提示符的快捷方式,Repository>Open in Command Prompt然后您可以通过它来执行git stash传统的 git CLI 命令。尽管如此,令人沮丧的是 GitHub Desktop 没有通过他们的 GUI 提供一种干净的方法来做到这一点,迫使你回退到 git CLI 工具来进行存储。

UPDATE!: Github Desktop apparently updated and can now stash by switching to another branch with uncommitted changes. You will automatically be asked if you want to leave your changes on the current branch(stash) or bring them to the other branch: enter image description here

更新!:Github 桌面显然已更新,现在可以通过切换到具有未提交更改的另一个分支来存储。系统会自动询问您是要将更改保留在当前分支(stash)上还是将它们带到另一个分支:在此处输入图片说明

Then when going back to the branch later, the you can restore from the stash, or discard them: enter image description here

然后当稍后返回分支时,您可以从存储中恢复,或丢弃它们: 在此处输入图片说明

回答by yogesh_desai

Now, with the Github Desktop 2.0 version, Rebase, and Stash features are available. More info can be found here

现在,有了 Github Desktop 2.0 版本,可以使用 Rebase 和 Stash 功能。更多信息可以在这里找到

回答by Dasser Basyouni

For those who are using Android Studio, no need for Github Desktop version in switching between branches, just switch from the Android Studio itself

对于使用 Android Studio 的用户,在分支之间切换不需要 Github Desktop 版本,只需从 Android Studio 本身切换即可

enter image description here

在此处输入图片说明

select the branch you want to switch to > Rebase onto

选择要切换到的分支 > Rebase on

PS: The Android Studio notify you with Rebase failederror (if you have created files in the branch you are on) and you will have to remove them by clicking on View themRetrythen select them all and delete with the red -sign button, then do a Rebase onto again.

PS:Android Studio 会通知您Rebase failed错误(如果您在所在的分支中创建了文件),您必须通过单击将其删除,View themRetry然后选择全部并使用红色-标志按钮删除,然后再次执行 Rebase .