Package: git
Version: 1:1.7.2.3-2.1
Severity: minor

man git-chechout states:

"Updates files in the working tree to match the version in the index or the 
specified tree.
If no paths are given, git checkout will also update HEAD to set the specified 
branch as the current branch. 

 git checkout [<branch>], git checkout -b <new branch> [<start point>] 
 This form switches branches by updating the index, working tree, and HEAD to 
reflect the specified branch. "

The key is the meaning of "to reflect": a normal (?) human being like me 
understands that git  checkout branch
will reset the contents of working directory, and index exactly equal to that 
of the head of the branch.
As you might know this is not true (see example below).

Please explain in the man page what checkout is exactly supposed to do. Thanks.

#####################
### BEGIN EXAMPLE ###
#####################

$ git init
Initialized empty Git repository in /home/guida/CACCA/gittest2+git/.git/
$ echo a>a;echo b>b
$ git add .
$ git commit -m 'a contains a; b contains b'
[master (root-commit) b158b7c] a contains a; b contains b
 2 files changed, 2 insertions(+), 0 deletions(-)
 create mode 100644 a
 create mode 100644 b
$ git checkout -b bra2
Switched to a new branch 'bra2'
$ git ls-files --stage
100644 78981922613b2afb6025042ff6bd878ac1994e85 0       a
100644 61780798228d17af2d34fce4cfbdf35556832472 0       b
$ echo aa>a;echo bb>b
$ git add b
$ echo cc>c
$ git ls-files --stage
100644 78981922613b2afb6025042ff6bd878ac1994e85 0       a
100644 e0b3f1b09bd1819ed1f7ce2e75fc7400809f5350 0       b
$ git checkout master
M       a
M       b
Switched to branch 'master'
$ git status
# On branch master
# Changes to be committed:
#   (use "git reset HEAD <file>..." to unstage)
#
#       modified:   b
#
# Changed but not updated:
#   (use "git add <file>..." to update what will be committed)
#   (use "git checkout -- <file>..." to discard changes in working directory)
#
#       modified:   a
#
# Untracked files:
#   (use "git add <file>..." to include in what will be committed)
#
#       c
$ cat a b c
aa
bb
cc
$ git diff
diff --git a/a b/a
index 7898192..e61ef7b 100644
--- a/a
+++ b/a
@@ -1 +1 @@
-a
+aa
$ git ls-files --stage
100644 78981922613b2afb6025042ff6bd878ac1994e85 0       a
100644 e0b3f1b09bd1819ed1f7ce2e75fc7400809f5350 0       b
$ git diff HEAD
diff --git a/a b/a
index 7898192..e61ef7b 100644
--- a/a
+++ b/a
@@ -1 +1 @@
-a
+aa
diff --git a/b b/b
index 6178079..e0b3f1b 100644
--- a/b
+++ b/b
@@ -1 +1 @@
-b
+bb

###################
### END EXAMPLE ###
###################
-- System Information:
Debian Release: squeeze/sid
  APT prefers testing
  APT policy: (900, 'testing')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.32-5-amd64 (SMP w/4 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages git depends on:
ii  libc6                   2.11.2-7         Embedded GNU C Library: Shared lib
ii  libcurl3-gnutls         7.21.0-1         Multi-protocol file transfer libra
ii  liberror-perl           0.17-1           Perl module for error/exception ha
ii  libexpat1               2.0.1-7          XML parsing C library - runtime li
ii  perl-modules            5.10.1-16        Core Perl modules
ii  zlib1g                  1:1.2.3.4.dfsg-3 compression library - runtime

Versions of packages git recommends:
ii  less                        436-1        pager program similar to more
ii  openssh-client [ssh-client] 1:5.5p1-5+b1 secure shell (SSH) client, for sec
ii  patch                       2.6-2        Apply a diff file to an original
ii  rsync                       3.0.7-2      fast remote file copy program (lik

Versions of packages git suggests:
pn  git-arch                      <none>     (no description available)
pn  git-cvs                       <none>     (no description available)
pn  git-daemon-run                <none>     (no description available)
pn  git-doc                       <none>     (no description available)
pn  git-email                     <none>     (no description available)
pn  git-gui                       <none>     (no description available)
pn  git-svn                       <none>     (no description available)
pn  gitk                          <none>     (no description available)
pn  gitweb                        <none>     (no description available)

-- no debconf information



-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to