Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7895677
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T07:42:02+00:00 2026-06-03T07:42:02+00:00

I use git-new-workdir to have two working trees for one git repository. This usually

  • 0

I use git-new-workdir to have two working trees for one git repository. This usually works very well, but I get funny behaviour after committing something, if the same branch is checked out in both working trees:

  • I start with both working trees clean and on “master”.
  • I commit something in working tree A.

Result:

  • “git status” in working tree A shows “clean” (as expected)
  • “git status” in working tree B suddenly shows “Changes to be committed”

The changes shown are the inverse of the commit I just made in A. For
example, if the commit in A added a line, the “Changes to be committed”
in B show that this line was removed.

What is happening here? Is this a known limitation of git-new-workdir?
Is there a way to avoid this problem? Or should I just avoid checking in
while the same branch is checked out in both copies?

I would also be interested in understanding what is happening here
internally (I know little about git’s internals).

Note:

I found that the problem is easy to resolve by just running
git reset--hard in B, if B had no uncommitted changes prior to the commit in A.

However, if I commit in A while there are uncommitted changes in B, the
real uncommitted changes get mixed with the bogus changes from the
commit, and there seems to be no easy way to disentangle them. Hence
the question.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T07:42:04+00:00Added an answer on June 3, 2026 at 7:42 am

    I think this is the intended behavior. From http://nuclearsquid.com/writings/git-new-workdir/:

    Create a new commit or branch in one of your working directories,
    they’re instantly available in all working directories.

    When you commit a change in A, that commit is available to B as well. Since the line you just added in A isn’t in B, it appears that you have made a change since the most recent commit.

    I think the purpose of multiple working directories is to have different branches checked out at the same time.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

When initialize a new git repository (on Linux/Ubuntu), we use: # What this doing:
I'm still a bit new to git, and I use gitg to visualize trees.
I know that I can use git commit --amend --file=path-to-my-new-message but this will amend
I have a new project starting up, and I was planning to use git
I use git to interface with an SVN repository. I have several git branches
I'm new to git. I use Windows, and github & bitbucket. I set up
I am a new user in Git world. I used to use Subversion (using
I'm looking to rewrite my git repo to use a new branching model I
I'm new to git so please feel free to RTFM me... I have multiple
My friend and I have elected to use git and GitHub to collaborate on

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.