1

I have a git repo with several folders in it

I want to checkout only 1 folder,and not all of them

What is the command for it ?

Lena Bru
  • 13,521
  • 11
  • 61
  • 126

2 Answers2

1

You can checkout any file or folder to wherever you like. E.g. If your current repository has a folder src/main/java you can do a

git --work-tree=/tmp/someCheckout checkout -- src/main/java

This will checkout the folder src/main/java to the directory /tmp/someCheckout.

René Link
  • 48,224
  • 13
  • 108
  • 140
0

You can simply run git checkout path/to/folder/ this will checkout all files inside the selected folder. You add files using git add path/to/folder/ to add all files inside the specified folder with all sub-folder files.

Qurashi
  • 1,449
  • 16
  • 27