-1

I have committed a few files on master and also merged some of the local branches with master branch. How can I get the list of committed files on the master branch?

Sajeev
  • 783
  • 3
  • 14
  • 46
  • You said you already commited them, what do you want to do exactly? – Etixpp Oct 17 '14 at 09:42
  • if we staged some files, we can see the files with git status. How can I see the committed files? I need the command like git status for listing the committed files. – Sajeev Oct 17 '14 at 09:45
  • I am not sure what you mean, maybe `git ls-files` is what you need. – xlembouras Oct 17 '14 at 09:47
  • I want to know what all are the files I committed in the branch. – Sajeev Oct 17 '14 at 10:00
  • gitk will show all the commits and information of all the files committed wrt that commit. You can also do git log – Gopi Oct 17 '14 at 11:20
  • @pala I think the OP is looking for a purely CLI solution. – jub0bs Oct 17 '14 at 11:29
  • @Jubobs: Sorry, none helped me. I could not found the list of committed files in my branch. I will explain the scenario once again. 1 I have staged files using git add. and committed those staged files using git commit -m 'comment'. My need is to get the list of committed files using any command. – Sajeev Nov 07 '14 at 07:31

2 Answers2

2

How can I get the list of committed files on the master branch?

git ls-tree lists the contents of a tree object. By default, it lists the permission, type, hash, and associated filename of each object referenced in the tree object, but you can tell it to print only the filename by using the --name-only option.

git ls-tree --name-only master

Edit (thanks Alex): you also probably want to use the -r flag to recurse into subtrees (i.e. the tree objects "nested" inside the top tree object of your commit).

git ls-tree -r --name-only master
jub0bs
  • 60,866
  • 25
  • 183
  • 186
1

I usually use

git ls-files

In the given plain form, it simply prints out the files committed in the current branch. To view files of a different branch, add the --with-tree parameter:

git ls-files --with-tree=master

lists all files of the master branch.

The docs of git ls-files provide more fine tuning possibilities.

eckes
  • 64,417
  • 29
  • 168
  • 201