libgit2 / libgit2/pygit2

Example for git reset HEAD -- filename.type please

未关闭
#601 0 条评论 1 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 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.

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 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

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。