Search code examples
gitgit-remote

couting number of files in git repository


Is there any possibility to count number of file in a git remote reposity without cloning them? In CVS we will use

cvs rls -lR $OldSrc $ProjectName'"  | grep -v -e '^\$' -e '$ProjectName' -e '^d' | wc -l

Where ,

    OldSrc --> Tag name [optional]
    ProjectName --> Actual project repository name.

Kindly tell me the convenient command in git.


Solution

  • You can't do that remotely. You have to either clone the git repository or ssh to the remote machine to look at the repository.

    Once you have a repository, you can list the files with, for example,

    git show master^{tree}
    

    You can replace master with the name of the branch/commit you are interested in. This command works also for bare repositories.