List of files committed to a git branch

Sep 29th, 2021 (edited)
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!

List of files committed to a git branch

  • Have you tried git ls-tree?

    git ls-tree --name-only -r <branch_name>

    --name-only gives you just the file names. -r recurses into sub directories.

  • If you want the name of the sub-directory listed before recursing into it, add -t to the argument list.

    git ls-tree --name-only $branch $directory/

    for a list of a specific directory

  • If your branch was derived from master you can use this command to list all new files that where added after branching:

    git diff master...new-branch --name-status --diff-filter=A

    Available filters for --diff-filter are: Added (A), Copied (C), Deleted (D), Modified (M), Renamed (R)

  • The git ls-files command lists all the files that exist in the latest commit on the current branch.

  • git diff --name-only to show a list of the files that are different between any two arbitrary commits.

  • git log --name-status will give the names and status of changed files in each commit

Add Comment
Please, Sign In to add comment