All of lore.kernel.org
 help / color / mirror / Atom feed
* Bug with git worktrees and git init
@ 2016-08-23 12:35 Max Nordlund
  2016-08-23 15:21 ` Michael J Gruber
  0 siblings, 1 reply; 34+ messages in thread
From: Max Nordlund @ 2016-08-23 12:35 UTC (permalink / raw)
  To: git

Hi,

I've been using multiple worktrees for months without issue (it's a
great feature, thanks), until recently when I wanted to add hooks to
them. So, when I added a template for the hooks, everything was fine
until I did a git reset --hard in the original repo which both applied
those changes to the other worktrees' working tree (the files on
disk), and made my master branch kinda lose it's connection to the
remote/think it was a kinda bare repo.

To reproduce this:

```
mkdir source-repo
cd source-repo
git init
touch foo
git add foo
git commit -m 'Add foo'
git worktree add ../worktree # which also creates a new branch 'worktree'
touch bar
git add bar
git commit -m 'Add bar'
cd ../worktree
git init
cd ../source-repo
git reset --hard master
cd ../worktree
git status # Suddenly `bar` has appear the working tree and is not tracked
```

I don't really now what is up with this, but I did notice that it is
the last worktree in which git init has been run that is affected. I
only ran git init to copy the hooks from the template, but if that is
not something you should do in a worktree then a check would have been
nice.

Thanks for this awesome tool, and I hope this helps
Max Nordlund

^ permalink raw reply	[flat|nested] 34+ messages in thread

end of thread, other threads:[~2016-09-25  3:16 UTC | newest]

Thread overview: 34+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-08-23 12:35 Bug with git worktrees and git init Max Nordlund
2016-08-23 15:21 ` Michael J Gruber
2016-08-24  9:35   ` Duy Nguyen
2016-09-08 13:47     ` [PATCH 0/3] Fix git-init in linked worktrees Nguyễn Thái Ngọc Duy
2016-09-08 13:47       ` [PATCH 1/3] init: correct re-initialization from a linked worktree Nguyễn Thái Ngọc Duy
2016-09-08 19:37         ` Junio C Hamano
2016-09-09 10:36           ` Duy Nguyen
2016-09-08 13:47       ` [PATCH 2/3] t0001: work around the bug that reads config file before repo setup Nguyễn Thái Ngọc Duy
2016-09-08 19:44         ` Junio C Hamano
2016-09-08 20:02         ` Jeff King
2016-09-09 10:32           ` Duy Nguyen
2016-09-09 11:22             ` Jeff King
2016-09-09 17:45               ` Jacob Keller
2016-09-08 13:47       ` [PATCH 3/3] init: do not set core.worktree more often than necessary Nguyễn Thái Ngọc Duy
2016-09-08 19:54         ` Junio C Hamano
2016-09-09 10:33           ` Duy Nguyen
2016-09-21 11:29       ` [PATCH v2 0/3] Fix git-init in linked worktrees Nguyễn Thái Ngọc Duy
2016-09-21 11:29         ` [PATCH v2 1/3] init: correct re-initialization from a linked worktree Nguyễn Thái Ngọc Duy
2016-09-21 11:29         ` [PATCH v2 2/3] init: do not set core.worktree more often than necessary Nguyễn Thái Ngọc Duy
2016-09-21 18:44           ` Junio C Hamano
2016-09-22 10:06             ` Duy Nguyen
2016-09-22 17:27               ` Junio C Hamano
2016-09-23 11:12                 ` [PATCH v2 4/3] init: combine set_git_dir_init() and init_db() into one Nguyễn Thái Ngọc Duy
2016-09-23 15:18                   ` Junio C Hamano
2016-09-23 22:53                   ` Junio C Hamano
2016-09-24 18:55                     ` Junio C Hamano
2016-09-25  3:13                       ` Duy Nguyen
2016-09-25  3:14                         ` [PATCH v3 1/5] init: correct re-initialization from a linked worktree Nguyễn Thái Ngọc Duy
2016-09-25  3:14                           ` [PATCH v3 2/5] init: call set_git_dir_init() from within init_db() Nguyễn Thái Ngọc Duy
2016-09-25  3:14                           ` [PATCH v3 3/5] init: kill set_git_dir_init() Nguyễn Thái Ngọc Duy
2016-09-25  3:14                           ` [PATCH v3 4/5] init: do not set unnecessary core.worktree Nguyễn Thái Ngọc Duy
2016-09-25  3:14                           ` [PATCH v3 5/5] init: kill git_link variable Nguyễn Thái Ngọc Duy
2016-09-21 11:29         ` [PATCH v2 3/3] init: reuse original_git_dir in set_git_dir_init() Nguyễn Thái Ngọc Duy
2016-09-21 18:18         ` [PATCH v2 0/3] Fix git-init in linked worktrees Junio C Hamano

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.