From: Markus Elfring <Markus.Elfring@web.de>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org
Subject: Re: Better cooperation between checkouts and stashing
Date: Sun, 28 Feb 2010 14:55:37 +0100 [thread overview]
Message-ID: <4B8A75D9.2090702@web.de> (raw)
In-Reply-To: <7vr5o6s5xf.fsf@alter.siamese.dyndns.org>
> It is important to understand that a local change does not belong to your
> current branch (it does not belong to _any_ branch). It belongs to you,
> and you can take it around while switching between branches. And that is
> a big time-saving feature.
It seems that we have got different expectations on the editing work flow when
we discuss the following situation.
elfring@Sonne:~/Projekte> git --version && mkdir try && cd try && git init --quiet \
> && echo one > XYZ.h && git add . && git commit --message=check-in --quiet \
> && git checkout --quiet -b feature1 && echo two > XYZ.h \
> && git checkout --quiet master && git status
git version 1.7.0
# On branch master
# Changed but not updated:
# (use "git add <file>..." to update what will be committed)
# (use "git checkout -- <file>..." to discard changes in working directory)
#
# modified: XYZ.h
#
no changes added to commit (use "git add" and/or "git commit -a")
I would prefer to return to the unchanged work tree because I made an adjustment
for a source file with the intention that this update should only belong to the
new topic branch. The switch did not provide a clean state from my view.
> - You are reading a mailing list message that asks for help, and you know
> the solution---you can give the help real quick.
>
> - You hack in whatever branch that happen to be checked out.
I would create another topic branch before.
> - The branch you happen to have checked out was 'next', but the solution
> is a bugfix, and should go to 'maint'.
>
> Now, at this point, you want to checkout 'maint' without losing your local
> change. The paths you touched with your quick fix are often not different
> between the two branches, and "checkout maint" will checkout the branch
> while keeping your local changes intact.
I can follow your view on convenience if the desired software maintenance is so
easy as in this example. I guess that it matters if only a simple branch switch
is needed or a corresponding content restore will also be required.
> In a case where "checkout -m" would result in a conflict too big to
> resolve, the original fix you made would not be applicable to 'maint'
> (iow, you should have solved it differently starting from 'maint'), and
> you may end up doing "reset --hard" and start from scratch, but that is a
> rare worst case.
I would like to be more careful so that I do not want to mix changes by accident.
> I said it is rare, because you would notice, while doing the "quick fix"
> based on 'next' codebase, that the code you are touching have changed
> since 'maint' and won't be applicable to its final destination (by that
> time you know you are "fixing"), and you won't waste too much time
> continuing to work in a checkout of 'next'.
I imagine that stashing will help to split the collected changes for different
branch targets.
Regards,
Markus
next prev parent reply other threads:[~2010-02-28 13:55 UTC|newest]
Thread overview: 56+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-02-01 18:50 Better cooperation between checkouts and stashing Markus Elfring
2010-02-01 20:40 ` Junio C Hamano
2010-02-01 21:57 ` Markus Elfring
2010-02-01 22:44 ` Eugene Sajine
2010-02-02 1:36 ` Petr Baudis
2010-02-02 10:26 ` Markus Elfring
2010-02-02 11:04 ` Petr Baudis
2010-02-09 19:20 ` Markus Elfring
2010-02-09 20:06 ` Junio C Hamano
2010-02-09 21:01 ` Markus Elfring
2010-02-18 17:43 ` Markus Elfring
2010-02-18 20:09 ` Junio C Hamano
2010-02-27 21:33 ` Markus Elfring
2010-02-27 21:51 ` Junio C Hamano
2010-02-28 13:55 ` Markus Elfring [this message]
2010-02-28 22:57 ` Michael Witten
2010-03-01 10:50 ` Markus Elfring
2010-03-01 17:02 ` Michael Witten
2010-03-01 17:23 ` Junio C Hamano
2010-03-01 18:14 ` Michael Witten
2010-03-01 18:29 ` Markus Elfring
2010-03-01 19:44 ` Junio C Hamano
2010-03-01 21:20 ` Markus Elfring
2010-03-02 1:41 ` Michael Witten
2010-03-02 9:35 ` Markus Elfring
2010-03-02 17:50 ` Junio C Hamano
2010-03-03 15:55 ` Markus Elfring
2010-03-04 7:46 ` Michael Witten
2010-03-04 19:55 ` Markus Elfring
2010-03-02 9:45 ` Markus Elfring
2010-03-02 18:05 ` Junio C Hamano
2010-03-03 16:00 ` Markus Elfring
2010-03-17 16:35 ` [PATCH] Clarification for the command "git checkout <branch>" Markus Elfring
2010-03-17 16:44 ` Avery Pennarun
2010-03-17 17:00 ` Markus Elfring
2010-03-17 17:58 ` Junio C Hamano
2010-03-17 18:21 ` Markus Elfring
2010-03-17 18:37 ` Junio C Hamano
2010-03-17 18:50 ` Michael Witten
2010-03-17 19:23 ` Junio C Hamano
2010-03-18 10:11 ` Markus Elfring
2010-03-18 16:36 ` Avery Pennarun
2010-03-18 17:19 ` Michael Witten
2010-03-18 17:33 ` Avery Pennarun
2010-03-19 8:28 ` Markus Elfring
2010-03-19 17:17 ` Avery Pennarun
2010-03-20 6:00 ` Markus Elfring
2010-03-19 8:15 ` Markus Elfring
2010-03-30 15:57 ` Markus Elfring
2010-03-30 22:13 ` Junio C Hamano
2010-03-31 3:58 ` Ramkumar Ramachandra
2010-04-01 4:52 ` Junio C Hamano
2010-04-01 13:09 ` Ramkumar Ramachandra
2010-04-01 6:38 ` Markus Elfring
2010-04-10 13:30 ` Markus Elfring
2010-04-10 22:31 ` Junio C Hamano
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=4B8A75D9.2090702@web.de \
--to=markus.elfring@web.de \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
/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).