获取特定Git提交的已更改文件及其状态的列表 [英] Get a list of changed files and their status for a specific Git commit

查看:99
本文介绍了获取特定Git提交的已更改文件及其状态的列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用以下Git命令

git diff-tree --no-commit-id --name-only -r <SHA>

以获取已更改文件的列表.

to get a list of changed files.

不幸的是,该列表未指定每个文件的更改类型:添加,修改或删除...等

Unfortunately, the list doesn't specify the type of change for each file: added, modified or deleted ... etc

如何在给定SHA的给定SHA中显示更改列表[更改类型,文件名].

How may I display a list of changes [type of change, file name] in a given SHA of a specific commit.

推荐答案

使用--name-status代替--name-only

git diff-tree --no-commit-id --name-status -r <SHA>

这将显示文件名,其状态字母为(摘自man):Added (A), Copied (C), Deleted (D), Modified (M), Renamed (R), have their type (i.e. regular file, symlink, submodule, ...) changed (T), are Unmerged (U), are Unknown (X), or have had their pairing Broken (B).

This will show the filename with a status letter of (extracted from man): Added (A), Copied (C), Deleted (D), Modified (M), Renamed (R), have their type (i.e. regular file, symlink, submodule, ...) changed (T), are Unmerged (U), are Unknown (X), or have had their pairing Broken (B).

这篇关于获取特定Git提交的已更改文件及其状态的列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆