Gitignore does not ignore intermediate

So I have no idea why this is not working.

I followed this lecture and made sure the .gitignore file was in the battletank folder.
Now I went to sourcetree and staged the files, from which Ben said the intermediate files would disappear.

But they don’t.

I committed the ignore file changes, made sure it was a gitignore file.

The context of the file is exactly the same as Ben’s…

How to fix this?

Could you provide screenshots of sourcetree, folders, and gitignore?


is that not the same folder as your .git folder? Is that a folder up?

This is a folder up…

Ah I see, then your gitignore is ignoring “Intermediate” and “Build” etc. from that folder. You would need to prefix your gitignore statements with BattleTank_04/

I am a real beginner in this sort of stuff, so I have no idea how…

Can you explain?

Your gitignore file is telling your git repo what files and folders to ignore. As you can see you have Intermediate/* That’s saying to ignore everything in the Intermediate folder (* is a wildcard to mean anything) relative to the git repo. So if you change that line to BattleTank_04/Intermediate/* it will ignore the correct folder.

Unfortunately it did not work…
In what folder should I put the .gitignore file?

Same as the git folder.

I have no idea why this does not work.

Did you stage the commit for the gitignore?

yes see below

that’s saying it’s removing a file called .gitignore.gitignore wheres the .gitignore?

I think i accidentally named the .gitignore file .gitignore, so now that is named .gitignore two times…
Don’t know if that would cause the problem… Maybe I will have to delete this project and start a new one.

Alternatively you can right click an unstaged file and choose to ignore it and for stuff in intermediate/build etc. you can select to ignore everything in that directory.

That was way easier. Thank you. I forgot about that option. I’ll just right click and then ignore it. Thanks!!

Privacy & Terms