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)
git fetch git log --name-status origin/master.. Will show you what commits you are about to retrieve, along with the names of the files. Based upon this reply the command "git log --graph -p" is doing a nice job. It shows tree information about the history and code changes as well.
Indeed, git fetch pulls down the latest code from remote to origin/branch at local. If you have no local branch with the same name, then git checkout 2.1. 0 will create it for you, and checkout to that branch. But, if you have one already, then git checkout 2.1.
git log --oneline is a great way to view commit history by displaying the first seven characters of the SHA-1 hash and commit message of the commits on the current branch. git log --oneline --graph presents commit history in a ASCII graph displaying the different branches in the repository and their commits.
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..
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With