Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way to see all changed files on a branch in Git?

Tags:

git

I apologise if this isn't very clear, but in Git, is there a way to see all changed files on a branch, by name only?

As far as I know, I can use git log to see files that have changed in a single commit, but I want to see all files that have changed since the branch was created, over several commits.

There is git diff, but this also lists the changed files in the branch I'm comparing to which I don't want to see. I kind of want a command that says 'show me file names for all changed files in this branch'.

like image 300
screenm0nkey Avatar asked Aug 02 '11 13:08

screenm0nkey


People also ask

How do I see all files in a branch?

For listing, you may use git ls-files to list all files recursively in the current index/working directory. You may refer to Git-SCM Docs / git-ls-files or type man git-ls-files if you have installed Git and have man pages available.


1 Answers

Supposing you're on branch foo, and you're interested in which files have changed since the point when it diverged from master, you can just do:

git diff --name-only master... 

(Note the three dots.) If you're not foo, you can use the full form:

git diff --name-only master...foo 

I made some graphics that explain the double-dot and triple-dot notations, and their differences between their meaning in git rev-list and git log - you can find them in this answer.

like image 172
Mark Longair Avatar answered Oct 14 '22 16:10

Mark Longair