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
  • 12,949
  • 9
  • 57
  • 112

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
  • 43,842
  • 12
  • 98
  • 127
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,399
  • 16
  • 26