How can I download a specific branch from a GitHub repo?

Our team is working with a application that has a number of directories in it’s home directory. We would only update files in certain directories (for example: etc, config scripts). I have created a git repo with just these 3 directories and files in them.

I have git client on my PC and 3 branches (master, acpt and dev). When I make changes to dev branch, I add/commit/push to remote repo. If I want to pull a certain branch only onto a server (example: pull the dev branch on the development application server, master branch on the production application server), do I need the git client installed on the application servers or is there a recommended way to download specific branches only to certain server.

1 Like

Hi @ravi567,

Git doesn’t allow you to clone individual branches, so you will need to clone the whole repository on each server, check out the particular branch that you want to have on that server and then make a pull of that branch when you make updates to it. This does require having a Git client installed on each of the application servers.


1 Like

The –single-branch --branch <branchname> options of the clone command limit downloads to a specific branch.