0

I am developing a wordpress site, in my .gitignore file I put the wordpress core files, among these files there is the xmlrpc.php file, on the other hand I have a plugin which contains a file from the same name "xmlrpc.php" so it was ignored too.

How can I ensure that only the xmlrpc.php file on the site root is ignored ?

Here is what I have in my .gitignore file:
#WordPress core files
wp-admin
wp-includes
xmlrpc.php
index.php
wp-activate.php
wp-blog-header.php
wp-comments-post.php
wp-cron.php
wp-links-opml.php
wp-load.php
wp-login.php
wp-mail.php
wp-settings.php
wp-signup.php
wp-trackback.php

2 Answers2

0

One has to be careful during a git add, else you may end up adding files that you didn’t want to commit. However, git rm will remove it from both your staging area (index), as well as your file system (working tree), which may not be what you want.

remove the file using git rm xmlrpc.php rather then using git reset filename # or echo xmlrpc.php >> .gitingore # add it to .gitignore to avoid re-adding it

Sanjeeth
  • 23
  • 1
  • 9
0

Prepend the filename with a slash / to only match files in the repository root. That is, your .gitignore should look like:

#WordPress core files
wp-admin
wp-includes
/xmlrpc.php
index.php
...

Add a / before all the filenames that this applies to.

seumasmac
  • 2,174
  • 16
  • 7