List files in any branch in git

twitter logo github logo ・1 min read

List entire branch content

~/my/repo $ git ls-tree mybranch -r --name-only
.gitignore
LICENSE
README.md
cli.js
demo.gif
index.html
live-svg.svg
package.json
server.js
tests/cli.js

List only one folder's content

You don't need grep!

~/my/repo $ git ls-tree mybranch:test -r --name-only
tests/cli.js

More informations about git ls-tree.

Hope it'll save you some time! 😜

twitter logo DISCUSS (1)
Classic DEV Post from Mar 24

Learning React, GraphQL, and Apollo?

How to build a URL shortener with React, GraphQL and Apollo

Mathieu PATUREL profile image
Don't have much inspiration for an original bio right now...