0

Well, I've made some stupid thing and I didn't add .idea folder to gitignore. Now I have 10 commits with this .idea rubbish and one, the last commit, which consciously adds .idea to gitignore. So, I'm trying to find a solution to clear all the previous commits from this .idea and I'm thinking of reorder the commits.

So, if I make my last commit, where .idea is added to gitignore, will it change all the other 10 following commits and make them without .idea files? If not, is there any other solution to clear these poor commits? Thank you in advance!

Jakov
  • 151
  • 13
  • No, it will not change any previous commit... What you can do is make a new branch, reset your code to that commit where you haven't committed your 'idea' stuff. And then update your new branch. – Aparna Apr 28 '16 at 18:45
  • Also, see for example "[Rewriting History](https://git-scm.com/book/en/v2/Git-Tools-Rewriting-History)" – larsks Apr 28 '16 at 18:50

1 Answers1

0

You need git filter-branch . Remember to backup .idea before doing this. The bad news is if others have cloned your repo, git filter-branch may bring them trouble.

ElpieKay
  • 27,194
  • 6
  • 32
  • 53