tags:

views:

33

answers:

1

I have a branch. Half way through I noticed git was not tracking a file that it should have been and so I added it as part of a commit and continued with my work. Now, I'm doing a git bisect and all commits before the file was added do not build. So I'm thinking, I need to split the commit that added the file into two parts: the file add and the rest of the commit. I then need to re-order the commits so that the file add commit will be at the beginning of my branch. Is this the correct solution or is there a better way of doing it?

A: 

It looks like the split and reorder is the easiest way to do what you want.
It would the same than:

  • marking your current branch as 'oldbranch'
  • resetting your branch on the commit before adding the file
  • adding the file and make a new commit
  • rebasing your oldbranch on top of this new 'current branch'
VonC