achyutdev
achyutdev

Reputation: 215

skip pulling new changes of certain file to server from github

My project source code is stored in GitHub and pulled to the server to run the project. There is a file which new changes should not be pulled to the server1. But that file is not untracked file to ignore using .gitignore file. Actually, new changes of the file are required to run the project on other servers.

Is there any way to skip pulling new changes of the file to server1 using git?

Upvotes: 1

Views: 67

Answers (1)

g19fanatic
g19fanatic

Reputation: 10931

I usually keep a separate branch (locally on server1) that has the version of the file that I want to keep.

Whenever I fetch/pull from the remote repository, I'll specifically do a

git checkout <mylocalbranch> - <filename>

This will overwrite the file with your special version.

I do this same thing in situations when files have 'passwords' or server/application specifics that shouldn't be uploaded to the public repos.

Upvotes: 1

Related Questions