0

I have merged my whole project on master branch.

After few commits with pushes, I have realized that I need to ignore directory from my commits.

I have added

database/

to my .gitignore file, but when I try again to commit and create pull request this folder normally exists in my commit.

How can I add it trully to .gitignore, after these several pull requests?

ldragicevic
  • 621
  • 4
  • 11
  • 22
  • `git rm -rf database`, update index, commit – hjpotter92 Sep 18 '17 at 22:06
  • 1
    @hjpotter92, _**watch out!**_ Your command will also delete `database/` from the working copy. Make sure to use `--cached` if it should remain in the working copy, but be removed from git. – ChrisGPT was on strike Sep 18 '17 at 22:07
  • @Chris I will mark it as duplicate since solution is the same. I would like to ask you just if I add folder to .gitignore with these commands, will it be ignored no matter of branch on which I am working/committing? – ldragicevic Sep 18 '17 at 22:22
  • @ldragicevic, maybe. Assuming your `.gitignore` is tracked by Git (it probably should be), it will probably change when you switch branches. It's a file, just like any other file. If it isn't tracked, and assuming there aren't any conflicts (e.g. by a `.gitignore` existing in another branch), it should take effect on all branches. – ChrisGPT was on strike Sep 18 '17 at 22:30

0 Answers0