开发者

Ignored files show up in changes not staged for commit

I have added

media/
build/

in.git/info/exclude, and after that deleted (git rm) both directories. I need these rules in the exlude file rather than .gitignore because I only want that repo to ignore it, not the blessed repo or any other repo. However running

git status

still lists the deletion of all the contents of both dirs. How do I prevent this?

EDIT

Here's what I have; a private repo on github, my local installation, some colleagues with their own local installation, and a server. The site is a Django site, so for performance the static media files are kept separate from the actual Django installation.

However, locally we have the media file inside the Django root. Therefor the media directory is also in the blessed repo at github. But the server should ignore the directory, this is what I was trying to accomplish by adding the directory to the exclude file. But even though it's in there, it doesn开发者_如何学运维't seem to get ignored.

adymitruk was right about the build folder, I've added it to my general .ignore file.


You said you deleted both the directories - so did you git rm them and commit it so that they are removed from the repo ( unversioned ) and not just removed in your working directory. Because, as long as they are versioned, git status will still show modifications to these directories ( in this case their deletion ) irrespective of the ignore.


Master is not a clone. It's a branch in a repo. I'm guessing you are referring to a blessed repository.

There are many ways to accomplish this:

  1. Make a branch where you delete the folders explicitly. Subsequent merges from other branches into this one will have conflicts due to changes in those folders. Use the recursive strategy with the "ours" option. Your branch will look like you intend.

  2. Make a complex smudge/clean script. I wouldn't go this route.

  3. Never stage changes to those files.

The greater issue is your workflow. There 2 issues that I see:

  1. You have media as part of the repository where you store code. This usually involves large files and is a great burden when cloning, checking out, etc. Consider using submodules for that directory and only populating them when you need to access the media.

  2. "Build" sounds like it's aritfacts? If they are build artifacts, they don't belong in the source repository. Manage them separately with whatever deploy scheme/tools you have. You can regenerate them from the source whenever you want. Rely on tagging to mark what was built/when/why.

I'm making a lot of assumptions about your workflow. But hopefully this will help you in some way.

Cheers

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜