git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: "Rubén Justo" <rjusto@gmail.com>
To: Bill Wallace <wayfarer3130@gmail.com>, git@vger.kernel.org
Subject: Re: Worktree shares a common remote with main checkout
Date: Fri, 22 Mar 2024 18:00:43 +0100	[thread overview]
Message-ID: <0ad0371c-c6ac-4ccb-b9a8-b30715f74308@gmail.com> (raw)
In-Reply-To: <CA+2m0i8E5Qnj520LXitoE49U_8V17v_NUnrqcRfzHz0cA_ONSQ@mail.gmail.com>

On Fri, Mar 22, 2024 at 10:50:30AM -0400, Bill Wallace wrote:
> This issue is just to fix an easy to make mistake when working with
> multiple remote origins and worktrees, where it is too easy to push to
> the wrong remote origin because one can't set the default origin on a
> per-worktree basis.
> 
> What did you do before the bug happened? (Steps to reproduce your issue)
> Used
> * git worktree to create a worktree
> * git remote add to add a custom repository
> * git commit/push to try to push changes
> 
> What did you expect to happen? (Expected behavior)
> Expected to have the git push recommend a remote origin that matched
> the worktree, but it defaults to 'origin' all
> the time, which means I need to checkout a clean clone from the
> specific origin I'm making changes for so that I don't accidentally
> push to the default origin.

Interesting.

Can you please describe in a little more detail the new behavior?

It may be obvious, but not to me, but what should we say in these cases:

  - 'git [-C <custom_worktree>] status'
  - 'git [-C <main-worktree>] status'
  - 'git [-C <custom_worktree>] branch --list -v -v'
  - 'git [-C <main_worktree> branch] --list -v -v'
  - ...

I'm sure there are others that I'm missing.  If you could explore and
describe them, perhaps with sketches, it would be a great help.

Thanks.

> What happened instead? (Actual behavior)

> Suggests 'origin' as the default origin - which is CORRECT for the
> main git branch, but I want to use worktrees to allow working against
> several remote origins, with the default being determined by which
> worktree I'm in.
> 
> What's different between what you expected and what actually happened?

> Suggested 'origin' for the --set-default rather than allowing me to
> define the origin I want, for example 'wayfarer' as teh name of my own
> remote that I have cloned on github.  The default origin is still
> supposed to be 'origin' for pulls/naming, but when I push, it needs to
> recommend the matching origin.
> 
> Anything else you want to add:
> This is a bit of feature request, but the reason I'm listing it as a
> bug is it makes it very easy to make a mistake by pushing to the wrong
> origin for a new branch.
> 
> Please review the rest of the bug report below.
> You can delete any lines you don't wish to share.
> 
> 
> [System Info]
> git version:
> git version 2.31.1.windows.1
> cpu: x86_64
> built from commit: c5f0be26a7e3846e3b6268d1c6c4800d838c6bbb
> sizeof-long: 4
> sizeof-size_t: 8
> shell-path: /bin/sh
> feature: fsmonitor--daemon
> uname: Windows 10.0 22631
> compiler info: gnuc: 10.2
> libc info: no libc information available
> $SHELL (typically, interactive shell): <unset>
> 
> 
> [Enabled Hooks]


  reply	other threads:[~2024-03-22 17:01 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-22 14:50 Worktree shares a common remote with main checkout Bill Wallace
2024-03-22 17:00 ` Rubén Justo [this message]
2024-03-22 17:15   ` Rubén Justo
2024-03-22 17:28 ` Kristoffer Haugsbakk
2024-04-03 14:26   ` Bill Wallace
2024-04-03 15:30     ` Phillip Wood
2024-04-03 16:18       ` Bill Wallace
     [not found]         ` <17c2d5148e3afb10.70b1dd9aae081c6e.203dcd72f6563036@zivdesk>
2024-04-03 18:29           ` Bill Wallace

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

  List information: http://vger.kernel.org/majordomo-info.html

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

  git send-email \
    --in-reply-to=0ad0371c-c6ac-4ccb-b9a8-b30715f74308@gmail.com \
    --to=rjusto@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=wayfarer3130@gmail.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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).