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

Re: for newbs = little exercise / tutorial / warmup for windows and other non-sophisticated new Git users :-) [Scanned]

From
ZZorba <cr@altmore.co.uk>
Date
Dec 31, 2008, 10:56 UTC
Message-ID
<gjfn28$3k2$4@ger.gmane.org>
In-Reply-To
<alpine.LNX.1.00.0812302143210.19665@iabervon.org>
Ok, starting from scratch, new dir, new repo

I can now get $ git checkout <version> to work (see extract below, missed the first few lines due to exceeding buffer)

The difference with the instance when I found "errors" is that that time I'd run $ git checkout <version> . a few times first, which as I now know, would have been making updates to the index all along.

I presume this is what screwed things up for the normal checkout situation, because when I ran $ git checkout <version> on all the versions, there were always less files than I expected in the working dir

Still not sure if I can trust $ git checkout <version>...
Why should
$ git checkout <version> .
screw things up for
$ git checkout <version>
?
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
BC

conorr@KINKLADZE /w/GITPLATFORM/swproj $ cat > AC.txt AC

conorr@KINKLADZE /w/GITPLATFORM/swproj $ cat > C.txt C

conorr@KINKLADZE /w/GITPLATFORM/swproj $ ls ABC.txt AC.txt BC.txt C.txt

conorr@KINKLADZE /w/GITPLATFORM/swproj $ git init Initialized empty Git repository in w:/GITPLATFORM/swproj/.git/

conorr@KINKLADZE /w/GITPLATFORM/swproj $ git add ABC.txt AC.txt

conorr@KINKLADZE /w/GITPLATFORM/swproj
$ git commit -m "version A"
Created initial commit 8ce0d2c: version A
 2 files changed, 3 insertions(+), 0 deletions(-)
 create mode 100644 ABC.txt
 create mode 100644 AC.txt

conorr@KINKLADZE /w/GITPLATFORM/swproj $ git tag versiona 8ce0

conorr@KINKLADZE /w/GITPLATFORM/swproj $ git rm AC.txt rm 'AC.txt'

conorr@KINKLADZE /w/GITPLATFORM/swproj $ ls ABC.txt BC.txt C.txt

conorr@KINKLADZE /w/GITPLATFORM/swproj $ git add BC.txt

conorr@KINKLADZE /w/GITPLATFORM/swproj $ git status # On branch master # Changes to be committed: # (use "git reset HEAD <file>..." to unstage) # # deleted: AC.txt # new file: BC.txt # # Untracked files: # (use "git add <file>..." to include in what will be committed) # # C.txt

conorr@KINKLADZE /w/GITPLATFORM/swproj
$ git commit -m "version B"
Created commit fad9c29: version B
 2 files changed, 1 insertions(+), 2 deletions(-)
 delete mode 100644 AC.txt
 create mode 100644 BC.txt

conorr@KINKLADZE /w/GITPLATFORM/swproj $ git tag versionB fad9

conorr@KINKLADZE /w/GITPLATFORM/swproj $ ls ABC.txt BC.txt C.txt

conorr@KINKLADZE /w/GITPLATFORM/swproj $ cat > AC.txt AC

conorr@KINKLADZE /w/GITPLATFORM/swproj $ ls ABC.txt AC.txt BC.txt C.txt

conorr@KINKLADZE /w/GITPLATFORM/swproj $ git commit -m "version C" # On branch master # Untracked files: # (use "git add <file>..." to include in what will be committed) # # AC.txt # C.txt nothing added to commit but untracked files present (use "git add" to track)

conorr@KINKLADZE /w/GITPLATFORM/swproj $ // mistake - forgot to stage changes sh.exe": //: is a directory

conorr@KINKLADZE /w/GITPLATFORM/swproj $ git reset --hard versionB HEAD is now at fad9c29 version B

conorr@KINKLADZE /w/GITPLATFORM/swproj $ ls ABC.txt AC.txt BC.txt C.txt

conorr@KINKLADZE /w/GITPLATFORM/swproj $ git add *c*.txt

conorr@KINKLADZE /w/GITPLATFORM/swproj $ git status # On branch master # Changes to be committed: # (use "git reset HEAD <file>..." to unstage) # # new file: AC.txt # new file: C.txt #

conorr@KINKLADZE /w/GITPLATFORM/swproj
$ git commit -m "version C"
Created commit 9cf73cb: version C
 2 files changed, 2 insertions(+), 0 deletions(-)
 create mode 100644 AC.txt
 create mode 100644 C.txt

conorr@KINKLADZE /w/GITPLATFORM/swproj $ git tag versionC 9cf7

conorr@KINKLADZE /w/GITPLATFORM/swproj $ ls ABC.txt AC.txt BC.txt C.txt

conorr@KINKLADZE /w/GITPLATFORM/swproj $ git rm *.* rm 'ABC.txt' rm 'AC.txt' rm 'BC.txt' rm 'C.txt'

conorr@KINKLADZE /w/GITPLATFORM/swproj $ ls

conorr@KINKLADZE /w/GITPLATFORM/swproj
$ git commit -m "version D"
Created commit 8e4b5be: version D
 4 files changed, 0 insertions(+), 4 deletions(-)
 delete mode 100644 ABC.txt
 delete mode 100644 AC.txt
 delete mode 100644 BC.txt
 delete mode 100644 C.txt

conorr@KINKLADZE /w/GITPLATFORM/swproj $ git tag versionD 8e4b

conorr@KINKLADZE /w/GITPLATFORM/swproj $ git status # On branch master nothing to commit (working directory clean)

conorr@KINKLADZE /w/GITPLATFORM/swproj $ gitk

conorr@KINKLADZE /w/GITPLATFORM/swproj <sionA = ABC.txt, AC.txt, version B = ABC.txt, BC.txt sh.exe": //: is a directory

conorr@KINKLADZE /w/GITPLATFORM/swproj $ cat > commet.txt// gitk confirms that versionA = ABC.txt, AC.txt, sh.exe": commet.txt//: No such file or directory

conorr@KINKLADZE /w/GITPLATFORM/swproj $ cat > comment.txt gitk confirms that: versionA = ABC.txt, AC.txt versionB = ABC.txt, BC.txt versionC = ABC.txt, AC.txt, BC.txt, C.txt versionD =

conorr@KINKLADZE /w/GITPLATFORM/swproj $ gitk

conorr@KINKLADZE /w/GITPLATFORM/swproj
$ git show
WARNING: terminal is not fully functional
commit 8e4b5bed1faadc608fc114e62bf1859b6bbed4a0
Author: Conor Rafferty <cr@altmore.co.uk>
Date:   Wed Dec 31 11:40:45 2008 +0000
    version D
diff --git a/ABC.txt b/ABC.txt
deleted file mode 100644
index 83871a5..0000000
--- a/ABC.txt
+++ /dev/null
@@ -1 +0,0 @@
-ABC
diff --git a/AC.txt b/AC.txt
deleted file mode 100644
index 9eadfae..0000000
--- a/AC.txt
+++ /dev/null
@@ -1 +0,0 @@
-AC
diff --git a/BC.txt b/BC.txt
deleted file mode 100644
index b3ac6f5..0000000
--- a/BC.txt
+++ /dev/null
@@ -1 +0,0 @@
-BC
diff --git a/C.txt b/C.txt
deleted file mode 100644
index 06a63fe..0000000
--- a/C.txt
+++ /dev/null
@@ -1 +0,0 @@
-C
(END)
conorr@KINKLADZE /w/GITPLATFORM/swproj
$

conorr@KINKLADZE /w/GITPLATFORM/swproj
$ git checkout versionA
Note: moving to "versionA" which isn't a local branch
If you want to create a new branch from this checkout, you may do so
(now or later) by using -b with the checkout command again. Example:
  git checkout -b <new_branch_name>
HEAD is now at 8ce0d2c... version A

conorr@KINKLADZE /w/GITPLATFORM/swproj
$ ls
ABC.txt  AC.txt  comment.txt

conorr@KINKLADZE /w/GITPLATFORM/swproj
$ git checkout versionB
Previous HEAD position was 8ce0d2c... version A
HEAD is now at fad9c29... version B

conorr@KINKLADZE /w/GITPLATFORM/swproj
$ ls
ABC.txt  BC.txt  comment.txt

conorr@KINKLADZE /w/GITPLATFORM/swproj
$ git checkout versionC
Previous HEAD position was fad9c29... version B
HEAD is now at 9cf73cb... version C

conorr@KINKLADZE /w/GITPLATFORM/swproj
$ ls
ABC.txt  AC.txt  BC.txt  C.txt  comment.txt

conorr@KINKLADZE /w/GITPLATFORM/swproj
$ git checkout versionD
Previous HEAD position was 9cf73cb... version C
HEAD is now at 8e4b5be... version D

conorr@KINKLADZE /w/GITPLATFORM/swproj
$ ls
comment.txt

conorr@KINKLADZE /w/GITPLATFORM/swproj
$ rm *.*

conorr@KINKLADZE /w/GITPLATFORM/swproj
$ ls

conorr@KINKLADZE /w/GITPLATFORM/swproj
$ git checkout versionA
Previous HEAD position was 8e4b5be... version D
HEAD is now at 8ce0d2c... version A

conorr@KINKLADZE /w/GITPLATFORM/swproj
$ ls
ABC.txt  AC.txt

conorr@KINKLADZE /w/GITPLATFORM/swproj
$ git checkout versionB
Previous HEAD position was 8ce0d2c... version A
HEAD is now at fad9c29... version B

conorr@KINKLADZE /w/GITPLATFORM/swproj
$ ls
ABC.txt  BC.txt

conorr@KINKLADZE /w/GITPLATFORM/swproj
$ git checkout versionC
Previous HEAD position was fad9c29... version B
HEAD is now at 9cf73cb... version C

conorr@KINKLADZE /w/GITPLATFORM/swproj
$ ls
ABC.txt  AC.txt  BC.txt  C.txt

conorr@KINKLADZE /w/GITPLATFORM/swproj
$ git checkout versionD
Previous HEAD position was 9cf73cb... version C
HEAD is now at 8e4b5be... version D

conorr@KINKLADZE /w/GITPLATFORM/swproj
$ ls

conorr@KINKLADZE /w/GITPLATFORM/swproj
$

"Daniel Barkalow" <barkalow@iabervon.org> wrote in message
>
>> wtf is wrong with
>>
>> git checkout <something>
>>
>> ??
>>
>> ** It doesn't reliably put the files that were in that revision into the
>> working directory - a fairly major flaw, for what I'm using SCM for (and
>> 80% of the market IMHO)
>
> It certainly does for me; I rely on it pretty much constantly. Can you
> give a sequence of commands (ideally the whole sequence from the "git
> init") that leads to a difference?
Previous: Sitaram ChamartyNext: Sitaram Chamarty
Message 10 of 11 in “RE: for newbs = little exercise / tutorial / warmup for windows and other non-sophisticated new Git users :-) [Scanned]”
  1. Conor RaffertyDec 31, 2008
  2. Jeff WhitesideDec 31, 2008
  3. Boyd Stephen Smith Jr.Dec 31, 2008
  4. Daniel BarkalowDec 31, 2008
  5. Daniel BarkalowDec 31, 2008
  6. ZorbaDec 31, 2008
  7. Sitaram ChamartyDec 31, 2008
  8. Daniel BarkalowDec 31, 2008
  9. Sitaram ChamartyDec 31, 2008
  10. ZorbaDec 31, 2008
  11. Sitaram ChamartyDec 31, 2008

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.