How to pull a single file from a server repository

2020-05-10 23:56发布

I am working on a site with a server running Git. I am using Git for deployment (not GitHub). This was set up prior to my involvement using a hook method, and I referred to this question and entered the commands below, but it didn't work.

How do I pull a single file from the server? For instance, if I wanted to update my local file index.php? git pull index.php?

8条回答
欢心
2楼-- · 2020-05-11 00:41
https://raw.githubusercontent.com/[USER-NAME]/[REPOSITORY-NAME]/[BRANCH-NAME]/[FILE-PATH]

Ex. https://raw.githubusercontent.com/vipinbihari/apana-result/master/index.php

Through this you would get the contents of an individual file as a row text. You can download that text with wget.

Ex. https://raw.githubusercontent.com/vipinbihari/apana-result/master/index.php

查看更多
成全新的幸福
3楼-- · 2020-05-11 00:43

Try using:

git checkout branchName -- fileName

Ex:

git checkout master -- index.php
查看更多
登录 后发表回答