Devin Dixon
Devin Dixon

Reputation: 12383

GIT pull files but have them be ignored

I know that .gitignore is used for ignoring files in push and pulls. But what I am trying to do is have like an add-on section, lets called it extra.

The flow works like this

  1. The developer pulls the application

  2. The extras section is automatically added to the gitignore

  3. Another developer modifies the application by adding in "plug-ings" to the extras section

  4. The developer pulls the application to keep it up-to-date but the extras section is never modified

My question is it possible to pull from git and already have a file or folder automatically be ignored?

Upvotes: 1

Views: 744

Answers (2)

KurzedMetal
KurzedMetal

Reputation: 12946

Add extra to .gitignore and add .gitignore to the repository.

So, when someone pull the repo, he will automatically get .gitignore and the extradirectory is automatically ignored.

Upvotes: 3

Simple example you have repository with 2 folders and 1 .ignore file

2 Folders
application and extras and
1 File
.gitignore

The .gitignore should have this in it
extras/

So whenever some body clones this repository they will get an extras folder where they can do what they want as it is ignored.

But if a developer makea a commit with content in the extras folder then developers that pulls from the repo, will get that content into the extras folder

Cheers

Upvotes: 0

Related Questions