简体   繁体   中英

Git only checkout certain directories

How can I setup my git project to only clone/checkout certain directories.

In my project I have the following directories

/dira
/dirb
/dirc

In some cases I would only like to checkout dira , in some cases I would only like to checkout dirb , and in some cases I would only like to checkout dirc . There are also times I would want to checkout all 3 directories.

Its pretty simple but you cant configure git to do automatically:

# Checkout any desired file or path
git checkout <commit id> -- /path/to/dir

Note

The 2 -- at the end are important and cannot be left off.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM