Hi guys, so a friend and I are working on a project and we sort of
completely screwed git up because of a series of bad ideas and
mistakes, but hopefully we can recover from it. All the commits we
want exist in some form, but there is a bit of weirdness going on with
other commits that we don't want, and files being deleted when they
should have been added, among other things.

Here's a history of what happened.

First, my friend did some refactoring, which created a new Java class.
Unfortunately, he forgot to commit that class, and he had already
pushed to github. I noticed this when I fetched his branch, but I
didn't merge it right away since I saw that the file was missing. I
told him, and he was kind of annoyed. First we thought "but you can
amend commits in git" except of course you don't want to do this when
you've already pushed somewhere, since the hashes will change and it
will screw up history. But I figured, do whatever you want, since I
haven't merged the changes in yet. He amends the commit, pushes to
github, I see it, and it's fine.

I work on the project for a bit, doing some refactoring of my own and
fixing a few bugs and such. After a while, I decide that I should
probably just pull in his changes, so I do a git merge. OOPS! I forgot
to fetch his master again after he amended the commit, so I've just
merged the old, incorrect commit, which doesn't exist on his fork but
by doing this I've apparently resurrected it. I realize my error, and
fetch and then merge his branch again, and now everything is fine.

Today we realized that he missed something in his refactoring, so he
fixes that and pushes to github. I fetch and merge, and all of a
sudden, a few strange things spontaneously appear and disappear. The
first odd thing is that when my friend first fixed the missing file
from the botched commit, he had done it in its own commit. As far as I
could tell, he never pushed that commit to github before, and had just
amended the incorrect commit and pushed that. Suddenly, this fix
commit appears out of nowhere, and is merged also when I do the merge.
I would think that since this commit changed things that were already
fixed in another alternate reality merge, it shouldn't do anything,
right? Instead, it actually seems to have reverted the changes in that
revision, and so it deleted the file that was supposed to have been
added. So now, I'm missing the file, and who knows what else is
borked.

Our project is here http://github.com/ibrahima/netbang/network , and
you can find my friend's fork through the network. As you can see, the
network view is very convoluted and confusing with all the weird
frankenmerges, and of course our source tree is completely borked
right now. Really, I wouldn't mind resetting to sometime before I
tried to merge anything, merge in all my correct commits, then merge
in his commits and fixes, and then push all this cleaned up history to
github (yeah, I don't learn my lesson, but hopefully this problem
should not happen twice?)

Is there a way I can do this? I'm thinking rebase will help, but I'm
not sure how to use it yet, since I'm still fairly new to git.

On a somewhat related note, I added my friend as a collaborator on my
repository. Does that mean he has commit access to my repo? Should we
both just work out of my one repo rather than out of two and keep
messing things up by merging? I mean, I guess if we actually do merges
properly without messing things up having a separate fork for his
stuff isn't so bad, but then what's the point of having collaborators?

Thanks for all who have the patience to read this massive email, and
even more thanks to anyone who can help me!

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"GitHub" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/github?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to