I see that if I register from one working line, the other will be offline
Actually, this is not so, and this problem!
Each work tree has its own HEAD and its own index (aka staging-area or cache). They all share the actual base repository and the main branch hint files, such as .git/refs/heads/mybranch .
Suppose there are two different work trees (I will only make them separate from the main repo so that there is no obvious βpreferredβ one), both have mybranch pointing to mybranch , and you are mybranch from one of the two working trees:
repo$ cd ../worktree1 worktree1$ ... hack away ... worktree1$ git add bar1 bar2 && git commit -m 'foo some bars'
Now the usual thing happens: Git writes the index to one or more trees, writes the new commit using the new tree and all that commit mybranch decides as its parent commit, and updates mybranch to the point to the new commit. The index for worktree1 now matches the new commit. Now we do this:
worktree1$ cd ../worktree2 worktree2$ ... modify unrelated file, not bar1 or bar2 ... worktree2$ git add unrelated && git commit -m 'unrelated change'
What happens is that Git writes the index ... wait, index? Which index? Well, an index is an index in worktree2 . Which has no files modified and added from worktree1 . (It has two bar files, unless they are completely new, but have old versions.) Well, that's why Git writes the index to one or more trees, writes a new commit using the new tree, and resolves any commit mybranch as its parent and updates mybranch to indicate a new commit.
The commit chain now looks like this:
...--o--1--2
where 1 is the commit made in ../worktree1 , and 2 is the commit made in worktree2 . The name mybranch , in both working trees, indicates commit 2 . The name HEAD , in both working trees, contains ref: refs/heads/mybranch . Of course, the index files in the two working trees are different.
The content for commit 1 is all that is in the index in worktree1 . He made changes to bar1 and bar2 .
The content for commit 2 is all that is in the index in worktree2 . It has the changes you made to unrelated , but it does not have the changes made to the files bar1 and bar2 . In fact, the commit you made in worktree2 returned two files!
If you want one or both work trees to be in a detached HEAD state, you can check them this way with git checkout --detach mybranch or git checkout refs/heads/mybranch . Now at least one of them will have a HEAD that points directly to the commit, not the branch name, and Git should allow two working trees to have the same commit.