I'm being asked to do an interactive rebase on my repo for clean history. I forgot to add a gitignore file to my previous commits

Viewed 25

I pushed six commits to my repo on GitHub and I had no idea the importance of adding a gitignore file. The request I have is:

Some things in your repo need to go. Add a standard .Gitignore file and make an interactive rebase so you can't see it was added from the start.

I honestly don't understand this sentence, am I not supposed to do the opposite? Make sure you can't see it wasn't added from the start?

1 Answers

If you're so new to Git, it will not be easy to do an interactive rebase without learning what it is. I recommend you to check what it is, how it works, etc. You can start here and also there's tons of tutorials on Git and you will find one for interactive rebasing as well.

Having said that, here are your steps:

  • Run git rebase -i --root
  • Add .gitignore file, remove files to remove, and amend your commit
  • Do this iteratively for the next 5 more commits
Related