DEV Community πŸ‘©β€πŸ’»πŸ‘¨β€πŸ’»

DEV Community πŸ‘©β€πŸ’»πŸ‘¨β€πŸ’» is a community of 963,864 amazing developers

We're a place where coders share, stay up-to-date and grow their careers.

Create account Log in
Mathieu PATUREL
Mathieu PATUREL

Posted on

List files in any branch in git

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
Enter fullscreen mode Exit fullscreen mode

List only one folder's content

You don't need grep!

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

More informations about git ls-tree.

Hope it'll save you some time! Γ°ΕΈΛœΕ“

Top comments (2)

Collapse
 
ferrmolina profile image
Fer Molina

Nice!

Collapse
 
fadc80 profile image
Fernando Costa

Does it work for remote branches?

Take a look at this:

Settings

Go to your customization settings to nudge your home feed to show content more relevant to your developer experience level. πŸ›