I do not need any history, I just want the files from the said branch to be downloaded locally .
This is for a deploy script
Usage: ./deploy.sh remote_branch_name
the script checks out an arbitrary branch from a remote github repository and copies the files to a server.
I figured I could use git 开发者_如何学Pythonclone without history:
git clone --depth 1 your_repo_url
But how can I specify a branch to checkout?
You can use the -b
flag with clone:
--branch
<name>
-b<name>
Instead of pointing the newly created HEAD to the branch pointed to by the cloned repository's HEAD, point to branch instead. In a non-bare repository, this is the branch that will be checked out.
You might also want to explore the downloads that github provides for your repo.
On github, download links are available like so:
https://github.com/username/reponame/zipball/branch
精彩评论