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

Working directory managment

From
Anjib Mulepati <anjibcs@hotmail.com>
Date
Mar 28, 2012, 14:10 UTC
Message-ID
<BLU0-SMTP479C08A291DA7BEA81F1875B14B0@phx.gbl>
In-Reply-To
<7vd37yj7h2.fsf@alter.siamese.dyndns.org>

So these removed or replaced is done automatically or as I understood we do merge and and see conflict and do changes as per necessary?

I was reading Git Community Book and came across following definition for working directory

The Working Directory

The Git 'working directory' is the directory that holds the current checkout of the files you are working on. Files in this directory are often removed or replaced by Git as you switch branches - this is normal. All your history is stored in the Git Directory; the working directory is simply a temporary checkout place where you can modify the files until your next commit.

What does it mean by this " Files in this directory are often removed or replaced by Git as you switch branches"?

Show 28 quoted lines
> I think the common terminology for the concept the above describes is "the
> working tree".
>
>> And does working directory is just a directory we get with $pwd ?
> After you clone, you have one directory that contains all the files from
> one specific version in it.  The files may be organized into directory
> hierarchy, but there is a single top-level directory.
>
> That is the "working tree".  When we want to be absolutely clear, we may
> even say "the top of the working tree", even though it may be redundant.
>
> If you are at such a directory, $(pwd) may match it.  If you chdir to a
> subdirectory from there, e.g. "cd Documentation", $(pwd) and the top of
> the working tree will of course disagree.
>
> The files checked out in the working tree represent the contents of the
> version that was checked out, plus modifications you make locally.  When
> you check out a different branch (people coming from svn background may
> say "switch branch", but it is the same thing), the working tree will need
> to represent the contents of the version at the tip of that different
> branch.  If you have a file in the current branch but not in that
> different branch you are checking out, that file has to go away.  If you
> do not have a file in the current branch but not in that different branch
> you are checking out, that file needs to be created in the working tree.
> If the contents of a file is different between your current branch and the
> branch you are checking out, the file in the working tree needs to be
> updated to match that of the branch you are checking out. That is what the
> "... are often removed or replaced" part is talking about.
>
>
>
>
Previous: jaseem abidNext: Junio C Hamano
Message 7 of 11 in “Definition of working directory”
  1. Anjib MulepatiMar 27, 2012
  2. Junio C HamanoMar 27, 2012
  3. Anjib MulepatiMar 27, 2012
  4. Junio C HamanoMar 27, 2012
  5. KevinMar 28, 2012
  6. jaseem abidMar 28, 2012
  7. Working directory managmentAnjib Mulepati, Mar 28, 2012
  8. Junio C HamanoMar 28, 2012
  9. Anjib MulepatiMar 28, 2012
  10. jaseem abidMar 28, 2012
  11. Junio C HamanoMar 28, 2012

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.