libgit2sharp - libgit2sharp - 如何仅撤消工作副本中的更改?
问题描述
给定存储库中已经存在的文件 a.txt,我们执行以下操作 - modify-stage-modify(again)。
如何撤消工作副本的更改(基本上将其还原为暂存版本)?
我尝试了 Repository.CheckoutPaths(),但它取消了工作副本和暂存副本。
谢谢,
宁
解决方案
您是否尝试指定文件路径?
using(var repo = new Repository("path"))
{
var opt = new CheckoutOptions();
repo.CheckoutPaths(repo.Head.Tip.Id.Sha, new string[] { "filepath" }, opt);
}
filepath
去哪里a.txt
推荐阅读
- javascript - Javascript - 在这种情况下如何显示 obj.element 的文本/字符串
- python - OpenCV 无法正确检测眼睛
- go - 不要从模型包中导入我的自定义模型
- django - 如何在 django-rest 中按日期范围过滤?
- vba - 试图从一个类中访问字典。运行时错误 91
- javascript - 记忆游戏星级错误(未捕获的类型错误:无法读取未定义的属性“删除”)
- hyper-v - Hyper-V 内部交换机 IP 地址(和网络)不断变化
- sql - 在 SQL PostgreSQL 中按行分组列
- html - Bootstrap4 行间距
- python-3.x - 从python数组中分割偶数/奇数索引的最佳方法?