Reputation: 44325
ls -R
or dir/s
that can list all files in a commit/branch. Upvotes: 120
Views: 150213
Reputation: 344
git ls-files
git ls-files
described in the git-scm docu:# Switch to <branch> of interest
$ git checkout <branch>
# List all files in <branch>
$ git ls-files
For further options check the documentation.
Upvotes: 6
Reputation: 11236
To compare the same file from different branches:
git diff branch_1..branch_2 file.txt
To list all files in a tree object:
git ls-tree -r branch
Upvotes: 38
Reputation: 1124
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.
It has nice options to show files in different ways like cached
, staged
, deleted
, modified
, ignored
or others
for the untracked. It also supports matching patterns. Having also a --debug
arg, you can easily list creation time
, modification time
, inode id
, owner & group id
, size
and flags
for files.
For the diff of two branch, simply use git diff <branch> <other branch>
as stated in other answers.
Upvotes: 3
Reputation: 289
To list all files added in the new branch
git diff --name-only branch1 master
Upvotes: 28
Reputation: 323464
git ls-tree -r --name-only <commit>
(where instead of <commit>
there can be <branch>
).-t
option which lists subdirectories before descending into themgit diff <branchA>:<fileA> <branchB>:<fileB>
,git diff <branchA> <branchB> -- <file>
Upvotes: 182