git - Git - 获取进行更改的文件的方法/函数名称
问题描述
在 c# 文件中进行更改后如何获取函数/方法名称。
解决方案
考虑到userdiff.c
确实包含 csharp,您只需要添加一个.gitattributes
文件(位于您的存储库的根目录),其中包含:
*.cs diff=csharp
然后 agit diff
将显示函数名称
有了它.gitattributes
,您可以在 diff 之后提取函数名称:
git diff | \
grep -E '^(@@)' | \
grep "(" | \
sed 's/@@.*@@//' | \
sed 's/(.*//' | \
awk -F " " '{print $NF}' | \
uniq
推荐阅读
- reactjs - 而不是从数组中删除项目,它被设置为未定义
- mysql - PHPMYADMIN | 我们如何在两个不同的 MySQL 数据库中同步两个表(在同一台服务器内)?
- vue.js - 路由器推送后 Nuxt 正在重新加载页面
- css - Bootstrap Dropdown 出现在其他元素的后面
- reactjs - 是什么导致错误:此代码中的重新渲染过多?
- sql - 执行以下 Oracle 查询时出错
- amazon-web-services - 将 docker Image 推送到 AWS ECR 时出现标记问题
- reactjs - 单击表单按钮时,Ant Design 表单元素未提交
- c++ - 在 C++ 中传递给 MPI 的结构
- python - 在Django的一个查询中获取多个对象