List all the files that ever existed in a Git repository

git list files in remote repository
git list files in branch
git list tracked files
git find file
git remove file
git remove file from commit
git delete file and commit
git show deleted files

Do you have a clean way to list all the files that ever existed in specified branch?

This is a simplified variation of Strager's solution:

git log --pretty=format: --name-status | cut -f2- | sort -u

Edit: Thanks to Jakub for teaching me a bit more in the comments, this version has a shorter pipeline and gives git more opportunity to get things right.

git log --pretty=format: --name-only --diff-filter=A | sort -u

List every file that has ever existed in a git repository Using sort, git log --all --pretty=format:\" \" --name-only | sort -u - (List every file that has ever existed in a git repository What was the name of that module  To show all of the tracked files that have been committed (on the current branch), use. git ls-tree --full-tree --name-only -r HEAD--full-tree makes the command run as if you were in the repo's root directory.-r recurses into subdirectories. Combined with--full-tree, this gives you all committed, tracked files.

This does the right thing for checking if a filename was ever present in the repo not just on the current branch.

git log --all --pretty=format: --name-only --diff-filter=A | sort - | grep fubar

Git - List all files currently under source control?, If you want to get a list of all files that ever existed, see here: If, for instance, you have a git repo for dotfiles ( core.worktree = / ), then you will have files outside  Retrieves all variations of files that ever existed within a repository - wcpfeffer/GitFileDeriver. Skip to content. Use Git or checkout with SVN using the web URL.

You can run git-log --name-status, which echoes something like:

commit afdbbaf52ab24ef7ce1daaf75f3aaf18c4d2fee0
Author: Your Name <your@email.com>
Date:   Tue Aug 12 13:28:34 2008 -0700

    Added test file.

A       test

Then extract files added:

git-log --name-status | sed -ne 's/^A[^u]//p' | sort -u

git-ls-files Documentation, NAME. git-ls-files - Show information about files in the index and the working tree cache index with the actual working directory list, and shows different combinations of the two. Recursively calls ls-files on each submodule in the repository. List all Git repository objects by size. Summary; Example; Summary. Bash script to: Iterate all commits made within a Git repository. List every object at each commit. Order unique objects in descending size order.

Here is two useful alias: FindFile ff and FindFilewithCopies ffc:

# Find if one file ever had into repository
ff = "!git log --pretty=format: --name-status --all -M -B | sort -u | grep $1   #"
# The same as above but showing copied files
ffc = "!git log --pretty=format: --name-status --all -C -M -B | sort -u | grep $1 #"

You get information about file names and operations with them.

Sample use:

$ git ff create
A       database/migrations/2014_10_12_000000_create_users_table.php
A       database/migrations/2014_10_12_100000_create_password_resets_table.php
A       database/migrations/2015_05_11_200932_create_boletin_table.php
A       database/migrations/2015_05_15_133500_create_usuarios_table.php
D       database/migrations/2015_05_12_000000_create_users_table.php
M       database/migrations/2015_05_11_200932_create_boletin_table.php
R051    database/migrations/2014_10_12_000000_create_users_table.php    database/migrations/2015_05_12_000000_create_users_table.php

$ git ffc create
A       database/migrations/2014_10_12_000000_create_users_table.php
A       database/migrations/2014_10_12_100000_create_password_resets_table.php
A       database/migrations/2015_05_11_200932_create_boletin_table.php
A       database/migrations/2015_05_15_133500_create_usuarios_table.php
C052    database/migrations/2014_10_12_000000_create_users_table.php    database/migrations/2015_05_11_210246_create_boletin_nosend_table.php
D       database/migrations/2015_05_12_000000_create_users_table.php
M       database/migrations/2015_05_11_200932_create_boletin_table.php
R051    database/migrations/2014_10_12_000000_create_users_table.php    database/migrations/2015_05_12_000000_create_users_table.php

git list tracked files, If you want a list of files that ever existed use: git log --full-tree makes the command run as if you were in the repo's root directory. -r recurses  For each one, list all the files; descend into directories recursively; include the size of the file. Cut out everything before the size of the file (which starts at character 54). Anything that starts with space is under a million bytes, so skip it.

git cheats · GitHub, Locally checkout all remote branches of a repository. git reset the last modified time for each file in a git repo to its last commit time List all files ever existed. The command to list all branches in local and remote repositories is: $ git branch -a. If you require only listing the remote branches from Git Bash then use this command: $ git branch -r. You may also use the show-branch command for seeing the branches and their commits as follows: $ git show-branch

How to completely remove a file from a Git repository, Have you already committed an SSH private key, a password file or a config file with The goal is to completely wipe a file out of existence in a Git repository, to cover a subdirectory, it will delete all files with the same name in any directory. git ls-files --unmerged and git ls-files --stage can be used to examine detailed information on unmerged paths. For an unmerged path, instead of recording a single mode/SHA-1 pair, the index records up to three such pairs; one from tree O in stage 1, A in stage 2, and B in stage 3.

First steps with git: clone, add, commit, push, Learn basic git commands, including clone, add, commit, and push. Once you have entered a repository name and made your selection, select Create Replace my-repo-name with the folder name of your repo (this should be ls -a )​, you should see all of the files that exist in your GitHub repository:. Git history visualizer. This script solve this problem: I want to visualize the history of all the files in a git repository [in one branch] The idea is to extract the whole commits log via the git command (you should have it on your machine) and process it to have: the list off the file ever existed in this branch

Comments
  • @Dustlin: Add --diff-filter=A option (list only added files). Current version (without sed filtering only added files) would fail if you have enabled rename detection and have renames in history. I think you can then use --name-only instead of --name-status and remove 'cut -f2-' from pipeline.
  • In one of my repos, I get quite a few duplicate lines (including a number of blank lines at the beginning of the output) with the second command that aren't dupes with the first.
  • If you need a bit more info than the file name: $ git log --pretty=format:"%h %an [%cd]: %s" --name-only | cut -f2- | sort -u | grep Filename.ext
  • Note: --all is something you will need if you have more than a single orphaned tip. Eg, multiple separate histories in one repo.
  • --diff-filter=A ignores files that were created by copying an already existing file, so adding it may not always be what you want.