Skip to content

Using git branchless sync stages changes in other worktress #1524

@TeofilC

Description

@TeofilC

Description of the bug

If I have two (or more worktrees) and use git branchless sync in one of them, then the other worktrees will get a bunch of staged changes.

I think what's happening is that git-branchless gets confused and updates the branch but the index gets stuck at where it was before?

Expected behavior

Running git branchless sync should rebase other worktrees but it shouldn't mess up the index.

Actual behavior

git branchless sync adds a bunch of changes to the index in other worktrees.

Version of rustc

No response

Automated bug report

Software version

git-branchless 0.10.0

Operating system

Linux 6.6.81

Command-line

/home/teo/.nix-profile/bin/git-branchless bug-report 

Environment variables

SHELL=/run/current-system/sw/bin/bash
EDITOR=vim

Git version

> git version 
git version 2.48.1

Hooks

Hooks directory: /home/teo/ch/mono/.git/hooks

Show 7 hooks
Hook post-applypatch
#!/bin/sh
## START BRANCHLESS CONFIG

git branchless hook post-applypatch "$@"
## END BRANCHLESS CONFIG
Hook post-checkout
#!/bin/sh
## START BRANCHLESS CONFIG

git branchless hook post-checkout "$@"
## END BRANCHLESS CONFIG
Hook post-commit
#!/bin/sh
## START BRANCHLESS CONFIG

git branchless hook post-commit "$@"
## END BRANCHLESS CONFIG
Hook post-merge
#!/bin/sh
## START BRANCHLESS CONFIG

git branchless hook post-merge "$@"
## END BRANCHLESS CONFIG
Hook post-rewrite
#!/bin/sh
## START BRANCHLESS CONFIG

git branchless hook post-rewrite "$@"
## END BRANCHLESS CONFIG
Hook pre-auto-gc
#!/bin/sh
## START BRANCHLESS CONFIG

git branchless hook pre-auto-gc "$@"
## END BRANCHLESS CONFIG
Hook reference-transaction
#!/bin/sh
## START BRANCHLESS CONFIG

# Avoid canceling the reference transaction in the case that `branchless` fails
# for whatever reason.
git branchless hook reference-transaction "$@" || (
echo 'branchless: Failed to process reference transaction!'
echo 'branchless: Some events (e.g. branch updates) may have been lost.'
echo 'branchless: This is a bug. Please report it.'
)
## END BRANCHLESS CONFIG

Events

Show 5 events
Event ID: 12096, transaction ID: 8940 (message: post-merge)
  1. CommitEvent { timestamp: 1742207934.0, event_tx_id: Id(8940), commit_oid: NonZeroOid(98ca209fe24bca8534316379ab8f5d166e11dd01) }
:
O 2fb979b 62d xxxxx xxxxx xx xxxxxxx xxxxxx xxxxxxxxxxxx xxxxxxxx
|\
: o 96991e2 16d (redacted-ref-0) xxxxx xxxxxxxxx xxxxx xx xxxxxxxxxxx
:
O 2764af8 40d xxxx xxxxxx xxxxxx xxxx xxxxxxxx
|\
: o 4c26c66 39d xxx
: |
: o cbd4c5d 16d (redacted-ref-1) xxx xxx xx xxx xxxxxx
:
O a9214c7 17d (redacted-ref-2) xxxxxxxxx xxxxx xxxxxxxxxxx xxxxxxx xx xxxx xx xxxxxx xxxxxxxx
:
O 2f6b99b 49m xxxxxxxxx xxx xxxxxxx xxx xxxxxxxxxx xxxxxxxxx xxxxxxxxxxx xxxxxxxx
|\
| o 228534d 24m xxxxxxx xx xxxxxxxx
| |
| o 42b8407 24m xxxxx xx xxxxxx xxxxx xxxxxx xxxx xxxxxxx xx xxxxxxxx
| |
| o d9a5016 24m xxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xx xxxxxx xxxxxxxx
| |
| o de543c3 24m xxx xxxx xxxxx
| |
| @ 1d020dd 24m (redacted-ref-3) xxxxxxxxx xxxxxx xx xxxxxxxx
|\
| o 2b9fe33 24m xxxx xxx xxxxx xxxxx xxxxxx
| |
| o a4c5fd1 24m xxxx xxxx xxx xxxxx xxxxxxxxxx
| |
| o 61c333c 24m (redacted-ref-4) xxx xxxx xxxxxxxxx xx xxxxxxx xxxxxxx xxxx xxxxxxxxx
|\
| o 3422b02 24m (redacted-ref-5) xxxx xxxxxxxxx xxxxxxxxxx xx xxxxxxxxxxxxxx
|\
| o 48174c2 24m (redacted-ref-6) xxxx xxxxxxxxxxxx xxxx x xxx xxxxxxxxxxxxxxxxxx xxx
|\
| o 8f5a857 24m xxx xxxxxxxxxxxx xxxxxxxx xxxxxx
|\
| o 985df2c 24m (redacted-ref-7) xxxx xxxxxx xxxxxxx xxx xxxxxxx xxxx
|\
| o bd8cb38 24m (redacted-ref-8) xxx xxxxx x xxxxx xxxxxxx xxxx
|\
| o ceef34e 24m (redacted-ref-9) xxxxxxx xxx xx xx xxx xxxxxxx
|\
| o f31b51d 24m (redacted-ref-10) xxxxxx xxxxx xx xxx xxxxxxxxxxx xxxxx xxxxxxxx
|\
| o f8df2ab 24m xxx xxxxxxxxxxxxxxxxx
| |
| o 0528aee 24m xxxx xxxxxxxxxxx x xxxxxxx
| |
| o e32d059 24m xxxx xxx xxxxx xxxx xxxx xxx xxxxxxx
| |
| o 538d842 24m xxxxx xxxxxxx
| |
| o e4916a2 24m (redacted-ref-11) xxxxxx xxxxxx xxxxxx xxxx
|\
| o f8ee1a0 24m (redacted-ref-12) xxxxx xxxxxxxxx xxxx xxxxxxxxx
|
O 98ca209 18m (master) xxxxxx xxxxxxx xx xxxxx xxxxxxxx
Event ID: 12094, transaction ID: 8939 (message: reference-transaction)
  1. RefUpdateEvent { timestamp: 1742208009.526978, event_tx_id: Id(8939), ref_name: ReferenceName("HEAD"), old_oid: 2f6b99b3554b69cb282769d1282ee0e1f93443cc, new_oid: 98ca209fe24bca8534316379ab8f5d166e11dd01, message: None }
  2. RefUpdateEvent { timestamp: 1742208009.526978, event_tx_id: Id(8939), ref_name: ReferenceName("refs/heads/master"), old_oid: 2f6b99b3554b69cb282769d1282ee0e1f93443cc, new_oid: 98ca209fe24bca8534316379ab8f5d166e11dd01, message: None }
:
O 2fb979b 62d xxxxx xxxxx xx xxxxxxx xxxxxx xxxxxxxxxxxx xxxxxxxx
|\
: o 96991e2 16d (redacted-ref-0) xxxxx xxxxxxxxx xxxxx xx xxxxxxxxxxx
:
O 2764af8 40d xxxx xxxxxx xxxxxx xxxx xxxxxxxx
|\
: o 4c26c66 39d xxx
: |
: o cbd4c5d 16d (redacted-ref-1) xxx xxx xx xxx xxxxxx
:
O a9214c7 17d (redacted-ref-2) xxxxxxxxx xxxxx xxxxxxxxxxx xxxxxxx xx xxxx xx xxxxxx xxxxxxxx
:
O 2f6b99b 49m xxxxxxxxx xxx xxxxxxx xxx xxxxxxxxxx xxxxxxxxx xxxxxxxxxxx xxxxxxxx
|\
| o 228534d 24m xxxxxxx xx xxxxxxxx
| |
| o 42b8407 24m xxxxx xx xxxxxx xxxxx xxxxxx xxxx xxxxxxx xx xxxxxxxx
| |
| o d9a5016 24m xxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xx xxxxxx xxxxxxxx
| |
| o de543c3 24m xxx xxxx xxxxx
| |
| @ 1d020dd 24m (redacted-ref-3) xxxxxxxxx xxxxxx xx xxxxxxxx
|\
| o 2b9fe33 24m xxxx xxx xxxxx xxxxx xxxxxx
| |
| o a4c5fd1 24m xxxx xxxx xxx xxxxx xxxxxxxxxx
| |
| o 61c333c 24m (redacted-ref-4) xxx xxxx xxxxxxxxx xx xxxxxxx xxxxxxx xxxx xxxxxxxxx
|\
| o 3422b02 24m (redacted-ref-5) xxxx xxxxxxxxx xxxxxxxxxx xx xxxxxxxxxxxxxx
|\
| o 48174c2 24m (redacted-ref-6) xxxx xxxxxxxxxxxx xxxx x xxx xxxxxxxxxxxxxxxxxx xxx
|\
| o 8f5a857 24m xxx xxxxxxxxxxxx xxxxxxxx xxxxxx
|\
| o 985df2c 24m (redacted-ref-7) xxxx xxxxxx xxxxxxx xxx xxxxxxx xxxx
|\
| o bd8cb38 24m (redacted-ref-8) xxx xxxxx x xxxxx xxxxxxx xxxx
|\
| o ceef34e 24m (redacted-ref-9) xxxxxxx xxx xx xx xxx xxxxxxx
|\
| o f31b51d 24m (redacted-ref-10) xxxxxx xxxxx xx xxx xxxxxxxxxxx xxxxx xxxxxxxx
|\
| o f8df2ab 24m xxx xxxxxxxxxxxxxxxxx
| |
| o 0528aee 24m xxxx xxxxxxxxxxx x xxxxxxx
| |
| o e32d059 24m xxxx xxx xxxxx xxxx xxxx xxx xxxxxxx
| |
| o 538d842 24m xxxxx xxxxxxx
| |
| o e4916a2 24m (redacted-ref-11) xxxxxx xxxxxx xxxxxx xxxx
|\
| o f8ee1a0 24m (redacted-ref-12) xxxxx xxxxxxxxx xxxx xxxxxxxxx
|
O 98ca209 18m (master) xxxxxx xxxxxxx xx xxxxx xxxxxxxx
Event ID: 12089, transaction ID: 8937 (message: reference-transaction)
  1. RefUpdateEvent { timestamp: 1742208009.3178189, event_tx_id: Id(8937), ref_name: ReferenceName("redacted-ref-13"), old_oid: d0da28924fa772ec356c91480e85cffdf9294a9f, new_oid: 0000000000000000000000000000000000000000, message: None }
  2. RefUpdateEvent { timestamp: 1742208009.3178189, event_tx_id: Id(8937), ref_name: ReferenceName("redacted-ref-14"), old_oid: 0e62bcb91bbe7b7142cbaba07ef9e36c4e408eaf, new_oid: 0000000000000000000000000000000000000000, message: None }
  3. RefUpdateEvent { timestamp: 1742208009.3178189, event_tx_id: Id(8937), ref_name: ReferenceName("redacted-ref-15"), old_oid: 99b1306b5fa8a13f4f858069b32f9609f645508d, new_oid: 0000000000000000000000000000000000000000, message: None }
  4. RefUpdateEvent { timestamp: 1742208009.3178189, event_tx_id: Id(8937), ref_name: ReferenceName("redacted-ref-16"), old_oid: 106c6ef71ff4b72ca5fceb4f7b8a9936c73b6584, new_oid: 0000000000000000000000000000000000000000, message: None }
  5. RefUpdateEvent { timestamp: 1742208009.3178189, event_tx_id: Id(8937), ref_name: ReferenceName("redacted-ref-17"), old_oid: d35d5c5b5bceaf5e2af6f713324356087aec318b, new_oid: 0000000000000000000000000000000000000000, message: None }
:
O 2fb979b 62d xxxxx xxxxx xx xxxxxxx xxxxxx xxxxxxxxxxxx xxxxxxxx
|\
: o 96991e2 16d (redacted-ref-0) xxxxx xxxxxxxxx xxxxx xx xxxxxxxxxxx
:
O 2764af8 40d xxxx xxxxxx xxxxxx xxxx xxxxxxxx
|\
: o 4c26c66 39d xxx
: |
: o cbd4c5d 16d (redacted-ref-1) xxx xxx xx xxx xxxxxx
:
O a9214c7 17d (redacted-ref-2) xxxxxxxxx xxxxx xxxxxxxxxxx xxxxxxx xx xxxx xx xxxxxx xxxxxxxx
:
O 2f6b99b 49m xxxxxxxxx xxx xxxxxxx xxx xxxxxxxxxx xxxxxxxxx xxxxxxxxxxx xxxxxxxx
|\
| o 228534d 24m xxxxxxx xx xxxxxxxx
| |
| o 42b8407 24m xxxxx xx xxxxxx xxxxx xxxxxx xxxx xxxxxxx xx xxxxxxxx
| |
| o d9a5016 24m xxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xx xxxxxx xxxxxxxx
| |
| o de543c3 24m xxx xxxx xxxxx
| |
| @ 1d020dd 24m (redacted-ref-3) xxxxxxxxx xxxxxx xx xxxxxxxx
|\
| o 2b9fe33 24m xxxx xxx xxxxx xxxxx xxxxxx
| |
| o a4c5fd1 24m xxxx xxxx xxx xxxxx xxxxxxxxxx
| |
| o 61c333c 24m (redacted-ref-4) xxx xxxx xxxxxxxxx xx xxxxxxx xxxxxxx xxxx xxxxxxxxx
|\
| o 3422b02 24m (redacted-ref-5) xxxx xxxxxxxxx xxxxxxxxxx xx xxxxxxxxxxxxxx
|\
| o 48174c2 24m (redacted-ref-6) xxxx xxxxxxxxxxxx xxxx x xxx xxxxxxxxxxxxxxxxxx xxx
|\
| o 8f5a857 24m xxx xxxxxxxxxxxx xxxxxxxx xxxxxx
|\
| o 985df2c 24m (redacted-ref-7) xxxx xxxxxx xxxxxxx xxx xxxxxxx xxxx
|\
| o bd8cb38 24m (redacted-ref-8) xxx xxxxx x xxxxx xxxxxxx xxxx
|\
| o ceef34e 24m (redacted-ref-9) xxxxxxx xxx xx xx xxx xxxxxxx
|\
| o f31b51d 24m (redacted-ref-10) xxxxxx xxxxx xx xxx xxxxxxxxxxx xxxxx xxxxxxxx
|\
| o f8df2ab 24m xxx xxxxxxxxxxxxxxxxx
| |
| o 0528aee 24m xxxx xxxxxxxxxxx x xxxxxxx
| |
| o e32d059 24m xxxx xxx xxxxx xxxx xxxx xxx xxxxxxx
| |
| o 538d842 24m xxxxx xxxxxxx
| |
| o e4916a2 24m (redacted-ref-11) xxxxxx xxxxxx xxxxxx xxxx
|\
| o f8ee1a0 24m (redacted-ref-12) xxxxx xxxxxxxxx xxxx xxxxxxxxx
|
O 98ca209 18m (master) xxxxxx xxxxxxx xx xxxxx xxxxxxxx
Event ID: 12088, transaction ID: 8936 (message: reference-transaction)
  1. RefUpdateEvent { timestamp: 1742208008.3408628, event_tx_id: Id(8936), ref_name: ReferenceName("redacted-ref-17"), old_oid: 0000000000000000000000000000000000000000, new_oid: d35d5c5b5bceaf5e2af6f713324356087aec318b, message: None }
:
O 2fb979b 62d xxxxx xxxxx xx xxxxxxx xxxxxx xxxxxxxxxxxx xxxxxxxx
|\
: o 96991e2 16d (redacted-ref-0) xxxxx xxxxxxxxx xxxxx xx xxxxxxxxxxx
:
O 2764af8 40d xxxx xxxxxx xxxxxx xxxx xxxxxxxx
|\
: o 4c26c66 39d xxx
: |
: o cbd4c5d 16d (redacted-ref-1) xxx xxx xx xxx xxxxxx
:
O a9214c7 17d (redacted-ref-2) xxxxxxxxx xxxxx xxxxxxxxxxx xxxxxxx xx xxxx xx xxxxxx xxxxxxxx
:
O 2f6b99b 49m xxxxxxxxx xxx xxxxxxx xxx xxxxxxxxxx xxxxxxxxx xxxxxxxxxxx xxxxxxxx
|\
| o 228534d 24m xxxxxxx xx xxxxxxxx
| |
| o 42b8407 24m xxxxx xx xxxxxx xxxxx xxxxxx xxxx xxxxxxx xx xxxxxxxx
| |
| o d9a5016 24m xxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xx xxxxxx xxxxxxxx
| |
| o de543c3 24m xxx xxxx xxxxx
| |
| @ 1d020dd 24m (redacted-ref-3) xxxxxxxxx xxxxxx xx xxxxxxxx
|\
| o 2b9fe33 24m xxxx xxx xxxxx xxxxx xxxxxx
| |
| o a4c5fd1 24m xxxx xxxx xxx xxxxx xxxxxxxxxx
| |
| o 61c333c 24m (redacted-ref-4) xxx xxxx xxxxxxxxx xx xxxxxxx xxxxxxx xxxx xxxxxxxxx
|\
| o 3422b02 24m (redacted-ref-5) xxxx xxxxxxxxx xxxxxxxxxx xx xxxxxxxxxxxxxx
|\
| o 48174c2 24m (redacted-ref-6) xxxx xxxxxxxxxxxx xxxx x xxx xxxxxxxxxxxxxxxxxx xxx
|\
| o 8f5a857 24m xxx xxxxxxxxxxxx xxxxxxxx xxxxxx
|\
| o 985df2c 24m (redacted-ref-7) xxxx xxxxxx xxxxxxx xxx xxxxxxx xxxx
|\
| o bd8cb38 24m (redacted-ref-8) xxx xxxxx x xxxxx xxxxxxx xxxx
|\
| o ceef34e 24m (redacted-ref-9) xxxxxxx xxx xx xx xxx xxxxxxx
|\
| o f31b51d 24m (redacted-ref-10) xxxxxx xxxxx xx xxx xxxxxxxxxxx xxxxx xxxxxxxx
|\
| o f8df2ab 24m xxx xxxxxxxxxxxxxxxxx
| |
| o 0528aee 24m xxxx xxxxxxxxxxx x xxxxxxx
| |
| o e32d059 24m xxxx xxx xxxxx xxxx xxxx xxx xxxxxxx
| |
| o 538d842 24m xxxxx xxxxxxx
| |
| o e4916a2 24m (redacted-ref-11) xxxxxx xxxxxx xxxxxx xxxx
|\
| o f8ee1a0 24m (redacted-ref-12) xxxxx xxxxxxxxx xxxx xxxxxxxxx
|
O 98ca209 18m (master) xxxxxx xxxxxxx xx xxxxx xxxxxxxx
Event ID: 12087, transaction ID: 8935 (message: reference-transaction)
  1. RefUpdateEvent { timestamp: 1742208008.3151498, event_tx_id: Id(8935), ref_name: ReferenceName("redacted-ref-16"), old_oid: 0000000000000000000000000000000000000000, new_oid: 106c6ef71ff4b72ca5fceb4f7b8a9936c73b6584, message: None }
:
O 2fb979b 62d xxxxx xxxxx xx xxxxxxx xxxxxx xxxxxxxxxxxx xxxxxxxx
|\
: o 96991e2 16d (redacted-ref-0) xxxxx xxxxxxxxx xxxxx xx xxxxxxxxxxx
:
O 2764af8 40d xxxx xxxxxx xxxxxx xxxx xxxxxxxx
|\
: o 4c26c66 39d xxx
: |
: o cbd4c5d 16d (redacted-ref-1) xxx xxx xx xxx xxxxxx
:
O a9214c7 17d (redacted-ref-2) xxxxxxxxx xxxxx xxxxxxxxxxx xxxxxxx xx xxxx xx xxxxxx xxxxxxxx
:
O 2f6b99b 49m xxxxxxxxx xxx xxxxxxx xxx xxxxxxxxxx xxxxxxxxx xxxxxxxxxxx xxxxxxxx
|\
| o 228534d 24m xxxxxxx xx xxxxxxxx
| |
| o 42b8407 24m xxxxx xx xxxxxx xxxxx xxxxxx xxxx xxxxxxx xx xxxxxxxx
| |
| o d9a5016 24m xxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xx xxxxxx xxxxxxxx
| |
| o de543c3 24m xxx xxxx xxxxx
| |
| @ 1d020dd 24m (redacted-ref-3) xxxxxxxxx xxxxxx xx xxxxxxxx
|\
| o 2b9fe33 24m xxxx xxx xxxxx xxxxx xxxxxx
| |
| o a4c5fd1 24m xxxx xxxx xxx xxxxx xxxxxxxxxx
| |
| o 61c333c 24m (redacted-ref-4) xxx xxxx xxxxxxxxx xx xxxxxxx xxxxxxx xxxx xxxxxxxxx
|\
| o 3422b02 24m (redacted-ref-5) xxxx xxxxxxxxx xxxxxxxxxx xx xxxxxxxxxxxxxx
|\
| o 48174c2 24m (redacted-ref-6) xxxx xxxxxxxxxxxx xxxx x xxx xxxxxxxxxxxxxxxxxx xxx
|\
| o 8f5a857 24m xxx xxxxxxxxxxxx xxxxxxxx xxxxxx
|\
| o 985df2c 24m (redacted-ref-7) xxxx xxxxxx xxxxxxx xxx xxxxxxx xxxx
|\
| o bd8cb38 24m (redacted-ref-8) xxx xxxxx x xxxxx xxxxxxx xxxx
|\
| o ceef34e 24m (redacted-ref-9) xxxxxxx xxx xx xx xxx xxxxxxx
|\
| o f31b51d 24m (redacted-ref-10) xxxxxx xxxxx xx xxx xxxxxxxxxxx xxxxx xxxxxxxx
|\
| o f8df2ab 24m xxx xxxxxxxxxxxxxxxxx
| |
| o 0528aee 24m xxxx xxxxxxxxxxx x xxxxxxx
| |
| o e32d059 24m xxxx xxx xxxxx xxxx xxxx xxx xxxxxxx
| |
| o 538d842 24m xxxxx xxxxxxx
| |
| o e4916a2 24m (redacted-ref-11) xxxxxx xxxxxx xxxxxx xxxx
|\
| o f8ee1a0 24m (redacted-ref-12) xxxxx xxxxxxxxx xxxx xxxxxxxxx
|
O 98ca209 18m (master) xxxxxx xxxxxxx xx xxxxx xxxxxxxx

Version of git-branchless

No response

Version of git

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions