git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Anjib Mulepati <anjibcs@hotmail.com>
Cc: git@vger.kernel.org
Subject: Re: Definition of working directory
Date: Tue, 27 Mar 2012 10:10:01 -0700	[thread overview]
Message-ID: <7vd37yj7h2.fsf@alter.siamese.dyndns.org> (raw)
In-Reply-To: <BLU0-SMTP1958653CC391F120060F8B6B14A0@phx.gbl> (Anjib Mulepati's message of "Tue, 27 Mar 2012 12:12:45 -0400")

Anjib Mulepati <anjibcs@hotmail.com> writes:

> 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"?

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.

  reply	other threads:[~2012-03-27 17:10 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-27 16:12 Definition of working directory Anjib Mulepati
2012-03-27 17:10 ` Junio C Hamano [this message]
2012-03-27 21:26   ` Anjib Mulepati
2012-03-27 23:01     ` Junio C Hamano
2012-03-28  6:06     ` Kevin
2012-03-28  9:40     ` jaseem abid
2012-03-28 14:10   ` Working directory managment Anjib Mulepati
2012-03-28 15:13     ` Junio C Hamano
2012-03-28 15:39       ` Anjib Mulepati
2012-03-28 16:31         ` jaseem abid
2012-03-28 15:41     ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7vd37yj7h2.fsf@alter.siamese.dyndns.org \
    --to=gitster@pobox.com \
    --cc=anjibcs@hotmail.com \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).