git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Martin Langhoff <martin.langhoff@gmail.com>
To: Howard Miller <howard@e-learndesign.co.uk>
Cc: git@vger.kernel.org
Subject: Re: Commited to wrong branch
Date: Tue, 15 Sep 2009 13:16:44 +0200	[thread overview]
Message-ID: <46a038f90909150416h60ea7d74xd2337fe50f603dcb@mail.gmail.com> (raw)
In-Reply-To: <26ae428a0909150405v3087016fxee5ac98057868677@mail.gmail.com>

On Tue, Sep 15, 2009 at 1:05 PM, Howard Miller
<howard@e-learndesign.co.uk> wrote:
> I'm pretty shocked how difficult this is... still...

No prob. It's only hard at the beginning :-)

> I'm finding git logs and reflogs pretty difficult to read and
> interpret (head melting) - in particular telling what happened on what
> branch -

I found gitk enormously helpful to visualise things. Try

 gitk # will show you the current branch

 gitk X Y # will show you both branches

gitk is a ton easier to visualise. git log is pretty good but won't
show merges, so it's limited.

git reflog is confusing, but it's mostly a tool to help when there's
been a mess and you want to diagnose WTH happened...

>but looking at the reflog (which I assume is showing me the
> actions on the current branch, but I'm not sure)

Don't worry about the reflog...

>  I think I must have
> made two commits on the wrong branch so the reset has only 'popped'
> the top one. Other than that your interpretation is correct.

Ok, so looking at gitk, there would still be one "wrong" commit. Can
you confirm?

> I cannot currently change branches - it only complains about one file.

If you did follow my previous instructions (specially doing 'git reset
--hard'), then this should not happen. Except...

Except when you have a file that git is not tracking, and it exists in
the "other" branch. The commit you undid earlier probably added that
file. So just rm that file, and change branches.

> I'm a bit worried about that - I would like to understand why this is
> a problem but I don't.

About the file? It was "new" in the commit you un-committed. So when
you do git reset --hard, git makes sure all the files it is
_currently_ tracking are "unchanged". If that file was new, it ignores
it. Just rm it and be happy.

> So I am now a little hazy on how to deal with previous TWO commits.

Just review gitk and confirm if there are more commits to unstich --
and we'll  work from there


m
-- 
 martin.langhoff@gmail.com
 martin@laptop.org -- School Server Architect
 - ask interesting questions
 - don't get distracted with shiny stuff  - working code first
 - http://wiki.laptop.org/go/User:Martinlanghoff

  reply	other threads:[~2009-09-15 11:17 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-09-15 10:31 Commited to wrong branch Howard Miller
2009-09-15 10:55 ` Martin Langhoff
2009-09-15 11:05   ` Howard Miller
2009-09-15 11:16     ` Martin Langhoff [this message]
2009-09-15 12:10       ` Howard Miller
2009-09-15 12:46         ` Martin Langhoff
2009-09-15 12:58           ` Howard Miller
2009-09-15 13:06             ` Björn Steinbrink
2009-09-15 13:12               ` Howard Miller
2009-09-15 13:54               ` Martin Langhoff
2009-09-15 14:11                 ` Howard Miller
2009-09-15 20:39                 ` Björn Steinbrink
2009-09-15 20:52                   ` Howard Miller
2009-09-15 21:53                   ` Martin Langhoff
2009-09-15 22:30                     ` Björn Steinbrink
2009-09-15 13:27             ` Howard Miller
2009-09-15 13:45               ` Howard Miller
2009-09-15 14:08                 ` Johannes Sixt
2009-09-15 13:46               ` Martin Langhoff
2009-09-15 11:19   ` Björn Steinbrink

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=46a038f90909150416h60ea7d74xd2337fe50f603dcb@mail.gmail.com \
    --to=martin.langhoff@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=howard@e-learndesign.co.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).