git/list[1] front-page[2] threads[3] people[4] search[5] about
 

bug report: git push fails in worktree

From
Ttionis <out@tionis.dev>
Date
Dec 6, 2022, 01:03 UTC
Message-ID
<COUBW3AG192J.1UCDLVUZ38VJA@tempest>

Thank you for filling out a Git bug report! Please answer the following questions to help us understand your issue.

What did you do before the bug happened? (Steps to reproduce your issue)
Setup two branches.  
Check the main one out in a repo.  
Checkout the second one using a worktree with
git worktree add ~/some/path branch-name
Add commits in ~/some/path
git status shows:
On branch dev
Your branch is ahead of 'dev/main' by 1 commit.
  (use "git push" to publish your local commits)
Execute git push

What did you expect to happen? (Expected behavior) expected the one commit to be pushed

What happened instead? (Actual behavior) the command only returns Everything up-to-date and nothing is pushed

What's different between what you expected and what actually happened? git should detect the commits to push correctly

Anything else you want to add: this was mentionend before on stack overflow: https://stackoverflow.com/questions/41158057/why-does-git-allow-pushing-to-a-checked-out-branch-in-an-added-worktree-how-sha

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.38.1 cpu: x86_64 no commit associated with this build sizeof-long: 8 sizeof-size_t: 8 shell-path: /bin/sh uname: Linux 5.15.80-1-MANJARO #1 SMP PREEMPT Sat Nov 26 13:41:30 UTC 2022 x86_64 compiler info: gnuc: 12.2 libc info: glibc: 2.36 $SHELL (typically, interactive shell): /bin/bash

[Enabled Hooks] post-checkout post-commit post-merge pre-push

Next: Junio C Hamano
Message 1 of 3 in “bug report: git push fails in worktree”
  1. tionisDec 6, 2022
  2. Junio C HamanoDec 6, 2022
  3. tionisDec 6, 2022

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.