1

I have updated Wordpress, and now BitBucket is asking me to commit the updates. According to my .gitignore file, everything should be ignored except my theme folder and some custom plugins.

I am using BitBucket to interface with the repository. Whats the easiest way to get BitBucket to "ignore" the updates to Wordpress Core?

Here is my .gitignore file.

# ignore everything in the root except the "wp-content" directory.
/*
wp-includes/*
wp-admin/*
!wp-content/

# ignore all files starting with .
.*

# except .gitignore
!.gitignore

# ignore everything in the "wp-content" directory, except: /mu-plugins /plugins /themes
wp-content/*
!wp-content/mu-plugins/
!wp-content/plugins/
!wp-content/themes/

# ignore everything in the "themes" directory, except: OUR theme
/wp-content/themes/*
!/wp-content/themes/hmh2017/

I've tried using the git commands:

git rm . -r --cached
git add .

as per https://stackoverflow.com/questions/11451535/gitignore-is-not-working and other posts.

Can I "Discard" or "Stash" these changes? How do I reset Bitbucket to only track whats specified in gitignore?

UPDATE:

I "stashed" the changes to WP-Core changes after updating. This, at least, makes me happy and it looks like BitBucket no longer cares about the Wordpress changes.

Still, I am confused as to why these changes are being tracked by Bit Bucket in the first place. What happens if I commit these changes? Am I misunderstanding the purpose of gitignore? Is this happening because of BitBucket itself, and I would see different results if I used the command line?

Update 2: I was wrong. Stash reverted my files. I knew I was mistaking the purpose of stash.

  • Were those files already tracked by git when you added the gitignore? As a sidenote, it's probably easier to ignore wp-content/uploads rather than the entire folder, that way you don't need to list exemptions – Tom J Nowell Sep 27 '17 at 18:28
  • Try to mention files and folders (in your case it's the dot .) after all git options: git rm -rf --cached . – Max Yudin Sep 27 '17 at 18:31
  • I just deleted the entire local instance, and downloaded a fresh version of the repo. When I downloaded, it downloaded entire WP install, which is fine, but not ideal. I editted the local wp-config.php to match with my local settings, and bitbucket is still tracking wp core files – Jeff Wilkerson Sep 27 '17 at 18:52
  • 2
    That's because core files are already tracked, and you have to remove them from the repository before you use .gitignore. – Max Yudin Sep 27 '17 at 19:22
  • @MaxYudin remove what? – Jeff Wilkerson Sep 27 '17 at 20:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.