git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Zorba" <cr@altmore.co.uk>
To: git@vger.kernel.org
Subject: Re: for newbs = little exercise / tutorial / warmup for windows and other non-sophisticated new Git users :-)
Date: Tue, 30 Dec 2008 12:19:54 -0000	[thread overview]
Message-ID: <gjd3lp$f1d$4@ger.gmane.org> (raw)
In-Reply-To: 3ab397d0812292133r7955e892g6c19ca46629e7103@mail.gmail.com

> I have been using $ git reset --hard <version> as an escalator to ascend /
> descend the versions up and down

you should probably be using git checkout for this

> Surely it doesn't alter the history, as I can commit versionA, versionB,
> versionC, and then reset to A, then reset to C, then reset to B.

i does alter the history.  i think this works because git isnt'
deleting the actual blob objects in the git dir until you use the git
prune, or gc or whatever (i never use it anyway).  but, you are
altering history, and just happen to be recovering.

** Ok!, so after commit B1, versionA doesn't store a link to versionB 
natively on and of its own accord. In other words BA and C are now written 
OUT of the history, as you say. I'm relying on some cached meta data that 
allows me to go back up the version tree again (ie downstream) and write B 
and/or C back into the history, which I should not rely on having access to 
all the time. Now I'm understanding more about differences between git-reset 
and git-checkout

> so when I reset to A, I've still got the ability to get to B or C again

with an uneasy conscience ;)

** yes, if the metadata cache failed or got wiped, I'd be screwed for 
getting back to later commits
I see !
I'm relying on something that isn't part of the intrinsic design... hmmm

> Now I appreciate that if I commit a new change from versionA (lets call it
> B1), then HEAD is now at B1, and B, C etc are lost, correct ?

yes! but this is not true if you had done a git checkout (there are
measures to recover B and C, provided you haven't done a prune.  i
think git reflog has some answers here, but i'm still a newbie).

> Its pertinent to where I am right now, as I've goofed a commit, and want 
> to
> reset, and commit again but I'm worried about leaveing garbage lying 
> around
> (the commits for version B and C in the example above).

you've goofed what commit (a1?, c?, d3?)?  where are you now and what
do you want to do now? reset to what version?  if you're just worried
about space used by B and C, i think git prune will purge these (look
at man page, don't guess at the syntax).

** I goofed B, so I reset to A, and redid the edits correctly this time 
(using your tip from other post $ git add -A = thanks again!), so now am on 
B1.
Having read your notes, I am now comfortable about letting B and C hang 
around, as I realise now they are out of the official picture. Sitaram's 
comparison of a linked list helps since there is no branch/merge: B1 can 
only have one parent, which is A, so A can only have one child which is B1 
(and B and C are relying on the cached stuff to survive, so let 'em freeze 
!)

i half suspect that you want to git branch at some point, but if
yo'ure just recretaing the other code bases' history form other files,
you shouldn't be able to break too much by git reset --hard, or git
prune.

** yes I might well want to at some point, but don't want to run before 
walking. I'm the only one on this project currently, and still archiving old 
versions into git. When I get the latest one in, I may branch so I can work 
away without affecting a stable master branch.

  reply	other threads:[~2008-12-30 12:21 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-12-27 21:56 for newbs = little exercise / tutorial / warmup for windows and other non-sophisticated new Git users :-) Zorba
2008-12-28  1:29 ` Zorba
2008-12-29 23:05   ` Jeff Whiteside
2008-12-30  4:24     ` Zorba
2008-12-30  5:33       ` Jeff Whiteside
2008-12-30 12:19         ` Zorba [this message]
2008-12-30  5:34       ` Sitaram Chamarty
2008-12-30 16:07     ` Zorba
2008-12-30 17:22       ` Zorba
2008-12-30 17:44         ` Zorba
2008-12-30 18:35           ` Jeff Whiteside
2008-12-30 21:39             ` Zorba
2008-12-30 22:03               ` Jeff Whiteside
2008-12-30 23:29               ` Daniel Barkalow
2008-12-31  0:31                 ` Zorba
2008-12-30 21:27           ` Zorba
2008-12-30 21:49             ` Boyd Stephen Smith Jr.
2008-12-30 22:17               ` Boyd Stephen Smith Jr.
2008-12-30 22:39                 ` Boyd Stephen Smith Jr.
2008-12-31  1:43             ` Sitaram Chamarty
2008-12-30 19:42 ` Daniel Barkalow

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

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

  git send-email \
    --in-reply-to='gjd3lp$f1d$4@ger.gmane.org' \
    --to=cr@altmore.co.uk \
    --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.
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 NNTP newsgroup(s).