mysterious git behaviour
I have since fixed this problem. But I still don't know why what I did worked.
We have an svn repository for our code at work. I have a local git-svn repository because I <3 Git. :) We use Windows, so I use Cygwin. I think the latest version in Cygwin is Git 1.7.0.4. On Friday, I dcommitted my code without a problem, went home. Monday morning I came back, and tried to 'git svn rebase' because someone had committed code over the weekend (overachievers).
It began normally, and then suddenly decided it couldn't find the trunk. Unfortunately, I lost the exact error message, but it was yelling about not being about to find /refs/remotes/trunk ...and I was very scared. Luckily, though, I had no uncommitted code. Nothing to lose. Nevertheless, every time I tried to 'git svn rebase' after that, it would hang forEVER, and then I would get the following error:
Unable to determine upstream SVN information from working tree history
I researched it for a whole day. I tried changing the svn-remote url from https://xxx.xxx.xxx/xxx/xxx to https://xxx.xxx.xxx/xxx/xxx/ as ridiculous as that seems. I then did a 'git svn fetch' ... and it re-fetched the whole trunk (all 1682 commits). But the rebase still wouldn't work. So I gav开发者_如何学编程e up for the day, and decided that the next day I would just create a new repository and start over (which would take a whole day). This morning, I went to ask the question on here before I went unabashedly deleting my repository. I came across this:
git-svn rebase gone horribly wrong
which wasn't exactly my problem, but I decided to try 'git reset --hard trunk' because that's what I wanted. And it worked. Everything is fine now.
However.
Why did it do that in the first place? I didn't change anything as far as I know, as I was not at work over the weekend. What kind of things would have caused that error? I assume I absent-mindedly did something awful, but I need to know what so I don't do it again. :)
Thanks in advance.
This error:
Unable to determine upstream SVN information from working tree history
Sounds like your current git history was not based on the svn history at all, and thus rebase couldn't find a common ancestor.
By changing the URL, I think all the commits have SLIGHTLY different commit messages, and therefore different sha1 hashes, and therefore your old ancestors do not match the new ones, causing rebase to fail.
As to why trunk disappeared/failed, it would be pretty hard to understand what happened without the error message.
精彩评论