首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >如何使用TortoiseGit临时存储和恢复选定的文件

如何使用TortoiseGit临时存储和恢复选定的文件
EN

Stack Overflow用户
提问于 2020-11-18 12:52:42
回答 3查看 387关注 0票数 1

我想临时存储一些修改过的文件,然后使用TortoiseGit恢复更改。就像藏身的东西一样。但我看不到任何选项来选择要存储的文件。任何替代选项,如创建补丁和恢复,也可以有所帮助。

我需要一个快速的解决方案。最好使用GUI。

EN

回答 3

Stack Overflow用户

发布于 2020-11-18 15:36:31

由于TortoiseGit stash不允许仅选择某些文件(从2.11开始):

  • 首先添加并提交您不想隐藏的
  • ,然后隐藏(使用TortoiseGit) rest

这样,您就可以继续只存储正确的文件。

票数 3
EN

Stack Overflow用户

发布于 2020-11-18 17:05:04

根据您的scanario,您可能有不同的选项:

  • 如果不想将某些失败作为一个整体提交,请转到提交对话框并取消选中这些文件。

  • 如果要部分提交文件,您(至少)有两个选择:

代码语言:javascript
运行
复制
1. If it this only applies to very few files, then you can use the "Commit and restore" feature of TortoiseGit (cf. [https://tortoisegit.org/docs/tortoisegit/tgit-dug-commit.html#tgit-dug-commit-restore](https://tortoisegit.org/docs/tortoisegit/tgit-dug-commit.html#tgit-dug-commit-restore)). Mark a file as "Restore after commit", diff it and make it look as you want to commit it and commit the changes. After the commit the file is restored to the old state.
代码语言:javascript
运行
复制
2. Commit all files to a new branch, switch back to your "old" branch and then compare the "new" branch to the current working tree and re-apply all changes you want to commit (if that are too many changes, you can also hard reset the "old" branch to the new branch and then perform a mixed reset back to the old commit - then you have all changes in your working tree again). This, can then be done again and again until all changes are committed.
票数 1
EN

Stack Overflow用户

发布于 2020-11-18 16:15:05

有一种命令行方法可以创建stash:

代码语言:javascript
运行
复制
git stash -- path/file1 path/file2 ...

创建的stash是一个常规的stash条目,之后您可以通过TortoiseGit的GUI "stash apply"/"stash pop“。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/64887298

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档