There are times we download or clone a full GitHub repository when all that is needed is a given folder in it.
Say (like me) you use PHP Code Sniffer Tool to analyze and detect violations of a defined coding standard in PHP code and you’ve decided to include PSR2 standard to your list of installed standards.
Instead of the old way of cloning or downloading the whole repository, i will show you how to download just the PSR2 folder via Apache Subversion (SVN).
Note: i use TortoiseSVN rather than using SVN on the command line thus it will be used in this tutorial.
- Navigate to the directory in your computer where you want to the GitHub folder (PSR2) to be installed.
- Right-click and select export sub-menu under TortoiseSVN.
- This is the part where i reveal the trick. to convert a Github git repo to svn, replace the
tree/master
inhttps://github.com/squizlabs/PHP_CodeSniffer/tree/master/CodeSniffer/Standards
to
trunk
making the url to behttps://github.com/squizlabs/PHP_CodeSniffer/trunk/CodeSniffer/Standards/PSR2
- Enter the url as the svn repository url and hit the Ok button.
- After some time, SVN will download the folder to your computer.