Re: [RFC/PATCH] Add multiple workdir support to branch/checkout

2 messages, 2 authors, 2016-06-15 · open the first message on its own page

Re: [RFC/PATCH] Add multiple workdir support to branch/checkout

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:52:11

Jay Soffian [off-list ref] writes:
So you're envisioning this?

  $ git commit foo.c
  Warning, master is also checked out in workdir2
No. I would rather think it needs to be forced.

Re: [RFC/PATCH] Add multiple workdir support to branch/checkout

From: Jay Soffian <hidden>
Date: 2016-06-15 22:52:11

On Wed, Oct 5, 2011 at 9:15 PM, Junio C Hamano [off-list ref] wrote:
Jay Soffian [off-list ref] writes:
quoted
So you're envisioning this?

  $ git commit foo.c
  Warning, master is also checked out in workdir2
No. I would rather think it needs to be forced.
Now they do what? Either commit --force or create a new branch?
Wouldn't it have been better to create the new branch before they
started editing?

Here's what I'm trying to avoid:

  $ cd workdir2
  $ git checkout master
  $ edit foo.c
  $ git commit foo.c
  By default, committing to a branch that is checked out in more than
  one location is denied, because it will make the index and work tree
  inconsistent in the other locations and will require 'git reset --hard'
  to match the work tree to HEAD in each of those other locations.

  Either switch to a new branch first with 'git checkout -b <new_branch>'
  or use 'git commit --force' to override this message.

User: "crap, I wanted that on master". Now they do what. Something like:

  $ git checkout -b foo
  $ git commit foo.c
  $ cd workdir1
  $ git cherry-pick foo
  $ git branch -d foo

Or maybe they use stash instead. In either case, I just think that's a
terrible user experience compared to:

 $ cd workdir2
 $ git checkout master
 error: master already checked out in workdir1
 $ cd workdir1
 $ edit foo.c
 $ git commit foo.c

I guess it depends what you mostly use your workdirs for. For me, it's
to have different branches checked out, not to have the same branch
checked out in multiple locations. I want git to help me up front, not
when I go to commit.

j.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help