Git list tracked files - how can I make git show a list of the files that are being tracked?

8.5K    Asked by AnkitChauhan in Data Science , Asked on Jul 12, 2021

Using command-line git, how can I make git show a list of the files that are being tracked in the repository?

Answered by Ankur vaish

To list all the files currently git show tracked files being tracked under the branch master using:

    git ls-tree -r master --name-only

This command will list the files that are being tracked currently.

If you want a list of files that ever existed use:

git log --pretty=format: --name-only --diff-filter=A | sort - | sed '/^$/d'This command will list all the files including deleted files.



Your Answer

Answer (1)

To list the files that are currently being tracked by Git in your repository, you can use the following commands:Basic Command

git ls-files: This command lists all the files that are being tracked by Git, including files in the staging area and the working directory.

  git ls-files

Detailed Options

The git ls-files command has several options that you can use to customize the output:

Show modified files only:

git ls-files -m

his lists only the files that have been modified.

Show deleted files only:

  git ls-files -d

This lists only the files that have been deleted but are still tracked by Git.

Show others (untracked files):

git ls-files --others




6 Months

Interviews

Parent Categories