Adding gitignore after multiple commits

I am working in a professional environment for about six weeks now and since the start I have been learning git. There was no version control system what so ever here, so one of my jobs is to change that.

Because every website we use is running on WordPress, I have been putting complete wordpress installations into git. After a while it got annoying because the websites upload files and obviously those aren’t tracked by git.

  • Practical uses of git reset --soft?
  • does a git repository have its own local value for core.autocrlf that overrides the global one?
  • View differences of branches with meld?
  • Revert some Git commits, keep others?
  • How to avoid rebase hell when merge commits are in the way?
  • Is it possible to use the gift library to view all of the branches of a remote repository?
  • After finding this I tried it on a completely new website and with minor edits it works perfectly! Now I would really like to use it on all the websites, but I don’t know what will happen if I just put the file in the repo’s. After reading some, git ignores the ignores for files that are already tracked. So I need to delete the files myself, but that is undoable for a whole WordPress installation! Is there a way of not losing my past commit information, but still use the new ignore file?

  • Jenkins finds cannot find ssh key
  • Filter Deletes during git svn clone?
  • Git bugtraq for all users who clone my repos?
  • Accept all merge conflicts in git
  • Enforce no-ff merge across a team
  • git - I seem to have too many remote branches. How did this happen? How do I fix it?
  • One Solution collect form web for “Adding gitignore after multiple commits”

    git rm --cached <file> will remove the file from the repo but not from the local file system, follow that with git commit and the file stops being tracked due to your new .gitignore file.

    Git Baby is a git and github fan, let's start git clone.