Git pull change log

假装没事ソ 提交于 2019-12-17 18:36:07

问题


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)


回答1:


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..




回答2:


An alternative command is:

git pull --stat 


来源:https://stackoverflow.com/questions/6535150/git-pull-change-log

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!