From: "Bradford Smith" <bradford.carl.smith@gmail.com>
To: git@vger.kernel.org
Subject: cg switch -l doesn't work when branches point to the same commit
Date: Wed, 11 Jul 2007 08:59:57 -0400 [thread overview]
Message-ID: <f158199e0707110559q43c290b4x2caee13cac46cf29@mail.gmail.com> (raw)
The message below applies to software versions:
git version 1.4.4.2
cogito-0.18.2
Why doesn't cg switch -l save local changes when you switch to a
branch that points at the same commit you're already on? Here's the
case I ran into.
1. On my master branch I was part of the way through making a fairly
complex change when I discovered an unrelated bug. So, I wanted to:
a. move my partial changes to a topical branch
b. fix the bug on master
c. finish my changes on the topical branch
d. merge the topical branch back into master
2. I didn't really want to _commit_ my partial changes yet, though,
because I was really in mid-thought there, so I wanted to do it this
way:
# create the topical branch, carrying my local changes along with me
cg switch -c topical-branch
# switch back to master, leaving my local changes with the topical branch
cg switch -l master
# fix bug on master then
cg commit
# switch back to topical branch
cg switch topical-branch
# continue with changes and eventually
cg commit
cg switch master
cg merge topical-branch
Unfortunately, I found that 'cg switch -l master' did NOT save my
local changes. I had to switch back to the branch, commit my partial
changes, then back to master to fix the bug. So, I was able to work
around this, but I still found the behavior surprising. If this is
expected behavior, shouldn't it be documented in the cg-switch man
page?
BTW, in a test repository/working directory I was able to confirm that
cg switch -l worked as documented when the two branches involved
pointed to different commits.
Thanks,
Bradford C. Smith
next reply other threads:[~2007-07-11 13:00 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-07-11 12:59 Bradford Smith [this message]
2007-07-11 13:36 ` cg switch -l doesn't work when branches point to the same commit Alex Riesen
2007-07-11 20:34 ` Sean
2007-07-11 20:44 ` Bill Lear
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=f158199e0707110559q43c290b4x2caee13cac46cf29@mail.gmail.com \
--to=bradford.carl.smith@gmail.com \
--cc=git@vger.kernel.org \
/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).