0

I have a directory named downloader in my Magento application's root directory.

At present it in version control. I want to make it possible that the directory and files should be version control (In the repository) to track any changes.

But I want to remove it safely from the production server and when ever I do git pull the directory should not be pulled on the server.

Also the there should be not message like deleted: downloader/ after deletion of directory from production server.

How to achieve this?

1 Answer 1

1

There is a feature called sparse checkout that allows you to do this - it basically tells Git to locally ignore part of your repository when checking out or when interacting with the index, e.g. git status.

Documentation here: https://git-scm.com/docs/git-read-tree#_sparse_checkout

Brief summary of what to do:

  • On your production server, at the top level of the repo, create a file .git/info/sparse-checkout and add two patterns, each on its own line: * and !/downloader/ (together meaning: everything but the downloader dir on the top level)
  • Enable this whole thing: git config core.sparseCheckout true
  • Run git reset - this will unstage any staged changes and, as a side effect, apply the patterns to your index so git status, git add and friends know about them.
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.