zenosama
zenosama

Reputation: 43

Git equivalent for the given svn status command?

'svn status -v "." | grep ^[ ACMR] | (some regex to get only file names)'.

This command essentially gives a list of all files and folders. What would be the git equivalent for the above 'svn' command. The git command 'git ls-files' lists all the tracked files and not the folders in the directory.

Upvotes: 1

Views: 248

Answers (2)

Enrico Campidoglio
Enrico Campidoglio

Reputation: 59923

git ls-files lists all the tracked files and not the folders in the directory.

Git tracks only files, not directories. More specifically, Git tracks the contents of files and their paths. This design choice is precisely the reason why you can't commit an empty directory.

Having said that, if you're looking to list all tracked files in your working directory, you can run:

git ls-files --full-name

where --full-name tells Git to print the paths relative to the root directory of the repository.

Upvotes: 2

Neil
Neil

Reputation: 11889

If you just want to list all the files and folders, ls will do this.

ls --recursive | grep ....

Upvotes: 1

Related Questions