I have committed several files on GitHub but I want to pull only single file on server. How can I do that using PuTTY?
Asked
Active
Viewed 1.5k times
3
-
Did you navigate to the file on the github web interface and click "RAW" on the upper right corner? You can use this url to download to get the content of the file in question. – Sgoettschkes Jun 28 '12 at 13:16
-
4Pulling in git means fetch+merge. And you fetch commits, never single files. There is no way to get a single file from a remote git repository, but see Alex's answer for how to get a single file from GitHub web interface. – user1338062 Jun 28 '12 at 13:18
-
I want to merge changes. Its not like downloading that file, downloading is so simple. – confofact Jun 28 '12 at 13:20
-
@user1338062: Write that as an answer if you are confident. – confofact Jun 28 '12 at 13:29
-
I am not sure if I (or the other commenters) have understood correctly what you really want to do - can you elaborate the original question a bit? – user1338062 Jun 29 '12 at 11:35
2 Answers
5
git fetch
git checkout -m revision -- the/file/you/want
git add the/file/you/want
git commit
checkout the file you want and merge it with the current one

helt
- 4,925
- 3
- 35
- 54
2
You can grab a single file via this URL:
https://raw.github.com/USER/PROJECT/BRANCH/FILE

Alex Howansky
- 50,515
- 8
- 78
- 98
-
I want to merge changes on server like using svn its `svn update filename` – confofact Jun 28 '12 at 13:21
-
1
-
good tip though. got me an answer i wasn't looking for but helps me out. – Joe Healy Sep 30 '15 at 19:43