tags:

views:

45

answers:

1

I half realize that this question is probably asked already, but I'm not familiar with the jargon and I need a really easy to follow answer perhaps a little too specific to my particular needs.

I forgot to remove the object files and then performed a git add -A. I then scanned a few man pages and used some kind of interactive mode and after some attempts had the object files removed.

I then performed a git push origin master to 'upload' the files to the remote server on github.com. It turned into three commits.

So my last four commits consist of:

  • 0) A past commit which is fine and dandy.
  • 1) A commit with the object files plus the code changes
  • 2) A commit where the object files are removed.
  • 3) A commit where added a .gitignore file (that someone sent to me over a month ago).

Basically I want the there to be one commit after 0, the diff of which should show all the changes except any evidence of those goddamn object files. How do I do this, if it is possible, please?

+1  A: 

Locally, use git rebase --interactive or your git tool of choice to get history like you like it. Then use git push origin master -f to force your version of master into the github repository.

Be aware that revising already-published history means that you have to go to everyone who's already pulled the revised changes and instruct them on getting the new changes, and rebasing away the old ones if they've done work on top of them.

David Winslow
Thanks it worked. There shouldn't be any problem with other people who have already pulled the revised changes - it's a small hobby project in an early Alpha borderline Beta stage.
James Morris