David
David

Reputation: 6162

How can I get JUST a unique list of files that changed on remote server since my last pull with Git

We are trying to figure out whether it makes sense to move to git from our previous version control system. One issue that we're struggling with is how to figure out succintly what files have been changed by someone else over all commits since the last pull. In particular, if the same file has been changed in multiple commits, we just want to see that file once in the list. From what I have read, it seems I have to actually pull the remote repository before I can check but even then, there doesn't seem to be a (simple?) way to just get a list of all filenames that have changed. Our understanding of git is not very deep yet, but the concern with doing a fetch is that some very large files (images, aiff and so forth) may have been pushed and nobody wants to have to fetch everything just to find out what has changed? I've read a few of the other Q/As in stackoverflow but although I've seen questions that seem similar, I haven't seen any answers that seem viable. We have been trying out several GUI tools to make life easier (Tower and SmartGit) but neither of them seems to be able to do this.

Upvotes: 0

Views: 384

Answers (3)

user4815162342
user4815162342

Reputation: 155590

The way to do show which files have changed between current and previous master:

git fetch
git diff --stat master origin/master

The first command retrieves the latest updates without changing your tree. The second one prints a list of changed files (along with insertion/deletion stats)—across all commits that would have been pulled if you had typed git pull. Afterwards, you can run git merge origin/master to merge your changes with the upstream ones. (This is equivalent to a git pull, except that pull can get new changes from the server if any have been pushed in the meantime.)

Unfortunately, git doesn't make it obvious how to diff without pulling the updates locally.

Upvotes: 1

CB Bailey
CB Bailey

Reputation: 793199

With direct access via ssh to the repository you can run something like this from a local clone.

ssh githost "git --git-dir=/data/repo.git diff --name-only\
             $(git rev-parse origin/master) master"

You probably want to put this in a script or alias. Note the the $(git rev-parse origin/master) runs locally in the clone to retrieve the id of the clone's remote tracking branch.

Upvotes: 1

Brandon
Brandon

Reputation: 66

Try:

git log --stat

That should print out a detailed log of the currently checked out repository.

Not sure git will do what you want without checking out locally first.

Upvotes: 0

Related Questions