创建更改的文件/目录/等的列表。在两个标签之间使用 git

发布于 2024-08-27 12:01:15 字数 149 浏览 5 评论 0 原文

我需要在使用 git 控制的项目中的两个标签之间生成某种变更日志,特别是 android 源代码。该列表应包括已编辑、移动、重命名、删除、创建的任何文件/目录/等。

任何帮助都会很棒。如果你有办法一次性在整个 Android 源代码上执行此操作......那就更好了。

I need to generate a changelog of sorts between two Tags within a project controlled using git, specifically the android source code. This list should include any files/directories/etc which have been edited, moved, renamed, deleted, created.

Any help would be great. And if you have a way to do this over the entire android source at once... even better.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

爱的十字路口 2024-09-03 12:01:15

如果需要查找哪些文件不同:

git diff --name-only <tag1> <tag2>

如果需要查找所有更改的文件:

git log --name-only --pretty=format: <tag1>..<tag2> |
    grep -v '^

--pretty=format: 是禁止打印有关提交的信息,并仅打印差异部分。请注意,在 git log 的情况下, 的顺序很重要。

| sort | uniq

--pretty=format: 是禁止打印有关提交的信息,并仅打印差异部分。请注意,在 git log 的情况下, 的顺序很重要。

If you need to find which files differ:

git diff --name-only <tag1> <tag2>

If you need to find all changed files:

git log --name-only --pretty=format: <tag1>..<tag2> |
    grep -v '^

The --pretty=format: is to supress printing information about commits, and print only the diff part. Note that in the case of git log the order of <tag1> and <tag2> matters.

| sort | uniq

The --pretty=format: is to supress printing information about commits, and print only the diff part. Note that in the case of git log the order of <tag1> and <tag2> matters.

月牙弯弯 2024-09-03 12:01:15

正如我在评论中提到的,“我如何找到公共文件在 git 分支之间发生了变化?” 是这里的主要解决方案:

git log [--pretty=<format>] --name-only tag1..tag2

或者

git diff --name-only tag1 tag2

(也在 Gitology 食谱

但是:如“如何获取我的 git 存储库中删除的目录列表?”,Git 只跟踪文件内容,而不跟踪目录本身

要包含有关目录的信息,您需要开始使用 git diff-tree

任何已创建或删除的目录将分别在第二列或第一列中显示 040000,并在第一列或第二列中分别显示 000000。这是左侧和右侧条目的树条目“模式”。

类似的东西(根据 Charles Bailey):

git diff-tree -t origin/master master | grep 040000 | grep -v -E '^:040000 040000'

As I mention in the comments, "How do I find common files changed between git branches?" is the main solution here:

git log [--pretty=<format>] --name-only tag1..tag2

or

git diff --name-only tag1 tag2

(Also mentioned in Gitology recipe)

BUT: as mentioned in "How to get a list of directories deleted in my git repository?", Git only tracks content of files, not directories themselves.

To include informations about directories, you need to start playing with git diff-tree.

any directory that has been created or removed will have 040000 in the second or first column and 000000 in the first or second column respectively. This are the tree entry 'modes' for the left and right entries.

Something like (according to Charles Bailey):

git diff-tree -t origin/master master | grep 040000 | grep -v -E '^:040000 040000'
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文