[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [gits] Git woes
I looked at your repo, and here's what I did to diagnose and correct the
problem.
git status
I saw that the imageversion branch was checked out, and I noticed that you
had some uncommitted work in the repo. So I stashed it:
git stash
Now I ran GitX on the reposiory to get an overview of the recent history. I
saw that your imageversion branch was no longer properly related to the
central/imageversion branch. The history looked something like this:
O-----O-----O-----O-----O-----O master
\ \
O O
central/ \
imageversion X
imageversion
(The X is a commit that is your new work, not yet in the central repository.)
This makes sense, based on what you said you did. And it also explains why
you can't push the imageversion branch up. "Pushing imageversion" here means
adding commits to the end of central/imageversion, and it's not possible to
add commits to central/imageversion to get it to "catch up" to your local
imageversion branch.
What we need to do is undo the rebase of your local imageversion branch. We
can do that by finding the old commits and then resetting "imageversion" to
point to those commits.
We can find the old commits by consulting the reflog:
git reflog | head -50
The output is attached at the end of this email. But the relevant parts are
this:
The commit that is currently at the tip of imageversion is this one:
4055334 HEAD@{3}: rebase: Another checkpoint of image versioning.
You can verify this by looking at the tree drawn in GitX, or by running "git
log -1", or other ways to figure out where you are.
The unrebased version of that commit is this one:
95ca510 HEAD@{15}: commit: Another checkpoint of image versioning.
You can identify this because it has the same log message as the (rebased)
commit that is currently at the tip of the imageversion branch.
So now we can undo the rebase by changing "imageversion" to refer to the
unrebased version of the commit. We already have the imageversion branch
checked out, so all we need to type is...
git reset --hard 95ca510
I.e., "make the tip of the current branch be commit 95ca510."
Looking at the updated history display in GitX, one can see that the history
now looks like this:
O-----O-----O-----O-----O-----O master
\
O central/imageversion
\
X imageversion
Importantly, notice that we have recovered the new work (X). This undoing is
possible because git keeps commits around for a while. The unrebased version
of X was still swimming around in your repository. Even though it was no
longer on any branch, we can refer to it by finding its hash in the reflog,
and we can recover it by making some branch refer to it.
At this point, you should be able to:
git push central imageversion # I did not do this
But you said that you also want to merge work from central/master.
git merge central/master
I did that in my local copy of your tree, and it merged without any
conflicts.
Now you could push that up:
git push central imageversion # I did not do this
And don't forget to pop your stash, to recover the work that was lying
around...
git stash pop
Give this a go, see if it gets you unstuck!
Eric.
-------------------------------------------------------------------------------
[gris-dmz:/z/testbed.images] eeide% git reflog | head -50
4055334 HEAD@{0}: checkout: moving from master to imageversion
33a20ab HEAD@{1}: checkout: moving from imageversion to master
4055334 HEAD@{2}: rebase finished: returning to refs/heads/imageversion
4055334 HEAD@{3}: rebase: Another checkpoint of image versioning.
9c03d48 HEAD@{4}: rebase: Check for ready bit.
0a243aa HEAD@{5}: rebase: More tweaks to image versioning. Note that I moved the snapshot call from
338aa24 HEAD@{6}: rebase: Add imagerelease and webclone_image.
b847c65 HEAD@{7}: rebase: New script to copy image from ops and mark it as released. Only for
6c2ffc9 HEAD@{8}: rebase: Another checkpoint; frisbee (loading) now supports image versions.
38bb6d4 HEAD@{9}: rebase: Checkpoint image provenance/versioning.
33a20ab HEAD@{10}: checkout: moving from imageversion to 33a20ab74c9906b903e2cf53579cf752238ade41^0
95ca510 HEAD@{11}: checkout: moving from master to imageversion
33a20ab HEAD@{12}: rebase finished: returning to refs/heads/master
33a20ab HEAD@{13}: checkout: moving from master to 33a20ab74c9906b903e2cf53579cf752238ade41^0
5aff2d8 HEAD@{14}: checkout: moving from imageversion to master
95ca510 HEAD@{15}: commit: Another checkpoint of image versioning.
5b09a48 HEAD@{16}: commit: Check for ready bit.
925d03c HEAD@{17}: commit: More tweaks to image versioning. Note that I moved the snapshot call from
1ec31b3 HEAD@{18}: commit: Add imagerelease and webclone_image.
ff3beba HEAD@{19}: commit: New script to copy image from ops and mark it as released. Only for
545e32c HEAD@{20}: commit: Another checkpoint; frisbee (loading) now supports image versions.
5acdd9c HEAD@{21}: commit: Checkpoint image provenance/versioning.
5aff2d8 HEAD@{22}: rebase finished: returning to refs/heads/imageversion
5aff2d8 HEAD@{23}: checkout: moving from imageversion to 5aff2d8954f7c7cfbe84dceb96dcf1c6d360a7d8^0
d4e3b3a HEAD@{24}: checkout: moving from master to imageversion
5aff2d8 HEAD@{25}: rebase finished: returning to refs/heads/master
5aff2d8 HEAD@{26}: checkout: moving from master to 5aff2d8954f7c7cfbe84dceb96dcf1c6d360a7d8^0
d4e3b3a HEAD@{27}: checkout: moving from imageversion to master
d4e3b3a HEAD@{28}: checkout: moving from master to imageversion
d4e3b3a HEAD@{29}: clone: from git-public.flux.utah.edu:/flux/git/emulab-devel.git
--
-------------------------------------------------------------------------------
Eric Eide <eeide@cs.utah.edu> . University of Utah School of Computing
http://www.cs.utah.edu/~eeide/ . +1 (801) 585-5512 voice, +1 (801) 581-5843 FAX