Example for git reset HEAD -- filename.type please
未关闭
还没有人认领这个 Issue。
documentation
- 主要语言
- Python
- 星标
- 1.7k
- 派生
- 408
- 平均合并
- 2 天 57 分钟
- 30 天内合并 PR
- 7
描述
I am coming at GIT with an external view of how it works. Internals I have very little idea about.
I have figured out that I need to call repo.reset() to do the same as git reset HEAD -- filename.type.
But I have no idea how to find the OID that I need to use.
Looking at git-reset code I seem to need a treeish. How do I get a treeish that corresponds to HEAD?
I guess I walk that tree looking for the filename and get a OID from the tree.
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
首先阅读提到的 repo.reset() API 和 git-reset 代码,重点了解如何获取与 HEAD 对应的 treeish 以及文件名的 OID。添加一个示例来说明 pygit2 中等价于 git reset HEAD -- filename.type 的操作后,即视为完成。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- git, python
- 领域
- documentation
- Issue 类型
- 文档
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 活跃度
- 停滞
- 描述清晰度
- 需要澄清
- 新手友好度
- 30/100