Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Excluding files

jeffrey October 2, 2017

How do I exclude files from the "unstage" box in Bitbucket?

 

I have a Wordpress site. The entire site, including the Core files, are uploaded to the repo. I only care about changes to one subdirectory of my Repo, the theme directory. How can I "exclude" all core files from being tracked locally?

I don't want to ignore the files and can't use .gitignore, because these files are already in repo. I am trying to use exlude, to no avail. I tried adding a file called .git/info/exclude; i've updated my local config and my global config to use exclude. Nothing happens, and Bitbucket is still  showing WP Core files as needing to be committed.

Why isn't there an easy way to tell Git/Bitbucket to "forget" about these files?

 

1 answer

0 votes
Ana Retamal
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
October 5, 2017

 

Hi Jeffrey, you can try 

git rm --cached 

This is used to remove a file from the index, it makes git stop tracking the file completely. In the case where the file is already in the repo, git rm --cached will remove the file from the index, leaving it in the working directory and a commit will now remove it from the repo as well. Basically, after the commit, you would have unversioned the file and kept a local copy. You can check the official documentation at Git rm.

Let us know if that's what you wanted!

Cheers,

Ana

jeffrey October 5, 2017

Thank you for the reply. I don't want to remove any files. Is there not a way to have Git or Bitbucket "forget" these files in my local repo? Can I remove these unecessary files from my list of 'unstaged' files?

jeffrey October 5, 2017

I'm trying to "Exclude" these files, but it seems those attempts are not doing anything. I've added an exclude file to .git/info directory, and i've updated my global .gitconfig file specifying what to exclude, but I don't see any changes. Perhaps I'm confused on the purpose of exclude?

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events