Git拉改变日志 [英] Git pull change log

查看:146
本文介绍了Git拉改变日志的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

从git服务器拉出后,我试图获取所有更改文件的列表。我不需要任何特定的代码部分,只需要一个文件列表(对于它被添加,删除或更改的某种指示)。



我首先看了一下使用git log,但是显然只会返回来自上次提交的信息:

git log --name-status --max-count = 1 --pretty = format:



自这显然只是从最后一次提交中获得更改,我试图找到一种方法来获取所有更改(pull几乎始终存在于多次提交之外)。



这是否有任何命令? (我与PHP之间的Git交互,btw) code>引用你以前的位置, HEAD 指的是你现在的位置。所以 ORIG_HEAD .. 表示拉入当前分支的更改。 - max-count = 1 表示最后一次提交,而不是您想要的,正如您发现的那样。

您可能需要像 git diff --name-status ORIG_HEAD .. 这样的内容,它将输出单字符状态代码和每个文件更改的文件名,将所有提交聚合在一起。如果你希望每次更改都要分解,你需要像 git log --oneline --name-status ORIG_HEAD ..


After pulling from a git server, I'm trying to get a list of all changed files. I don't need any specific parts of code, just a list of files (with some kind of indication as to wether it's been added, removed or changed).

I first looked at using git log, but that appearantly only returns info from the last commit:

git log --name-status --max-count=1 --pretty=format:""

Since this appearantly only gets the changes from the last commit in a pull, I'm trying to find a way to get all the changes (the pull almost always exists out of multiple commits).

Is there any command for this? (I'm interacting with Git from PHP, btw)

解决方案

After a pull, ORIG_HEAD refers to where you were before, and HEAD refers to where you are now. So ORIG_HEAD.. means the changes pulled into the current branch. --max-count=1 means just the last commit, not what you want, as you discovered.

You probably want something like git diff --name-status ORIG_HEAD.. which will output a single-character status code and a filename for each file changed, aggregating all the commits together. If you want it broken down by each change, you need something like git log --oneline --name-status ORIG_HEAD..

这篇关于Git拉改变日志的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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