Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

pull specific commit/file from git

I have made two commits in my git repository and push them to my git server

the two commits are

  • In first commit file A is committed
  • In second commit file B is committed

now on the other development server I want to pull only the first commit or FILE A from git server. How to do this ?

like image 358
Dau Avatar asked Jan 19 '12 06:01

Dau


People also ask

Can you git pull a specific commit?

The short answer is: you cannot pull a specific commit from a remote. However, you may fetch new data from the remote and then use git-checkout COMMIT_ID to view the code at the COMMIT_ID .

How do I pull a specific file in git?

git checkout origin/master -- path/to/file // git checkout / -- path/to/file will checkout the particular file from the downloaded changes (origin/master). That's it!


1 Answers

This doesnt make to much sense - if you commited the files you have them in your repo anyway.

Maybe this is what you want

git checkout -- FileAOnly

Or

git checkout origin/master -- FileAonly
like image 60
Adrian Cornish Avatar answered Oct 14 '22 02:10

Adrian Cornish