Michael Sperber writes:
Could you elaborate on what "git reset" does? From the git
user manual,
I think what you want is exactly:
hg update -C <rev>
No, I *definitely* don't want the -C, and if I do have
... (possibly without the -C) but I don't know what that has to
do with
"preserving" changesets, or how it implies a merge.
AFAICT when you do "hg qpop", the changeset disappears irreversibly.
When you do "hg qpush", the same patch is reapplied but a new
changeset is created. Am I missing something?
I don't know what you're talking about "implies a merge" -- so
let's
not worry about it, just assume I wrote something meaningless and
forgot to delete it before sending.
From what I read in the git manual, "reset" just affects
the
working tree, not the revision history.
No, reset (without a file argument) by default affects the index and
HEAD and leaves the working tree alone. (The index is where the
"add", "remove", and "to commit" state is stored, among
other things.)
The revision history itself is immutable except by "git gc --prune".
"git reset --hard" is exactly equivalent to "hg update -C", I think.
So, for example if I do
# make changes
git commit -m "first"
# make changes
git commit -m "second"
git tag tip
git reset HEAD^
then the index ("git status", more or less) will show that I've got
the changes in "second" in the workspace, but HEAD will point to the
commit logged as "first", and a new commit will have the commit logged
as "first" as its parent. If I use the "--soft" flag, then the index
will show that all of those changes are staged for committing.
Finally, I can do "git reset tip" and I'll be back where I started.
To use the Lisp analogy, HEAD is a (magic) variable containing a
commit. A commit is basically a cons. All information except
ancestry is encapsulated in the car of a commit, the parent is the
cdr. "git commit" is like "(push (make-commit-info) HEAD)".
"^" is
the cdr operation, and "~" is nthcdr. "git reset" is basically
"setq"; without --soft or --hard, it has no implicit side effects,
just the explicit one. So "git reset HEAD^" is just "(setq HEAD (cdr
HEAD))". "git tag" and "git branch" also are basically
"setq".
The naive Lisp analogy fails at two points. First, a git commit's
"cdr" can be multivalued, ie, if it's a merge commit. Second, HEAD is
"(magic)" because its value is normally not a commit, it's a branch.
The branch is automatically dereferenced to a commit in all contexts I
know of (except if you cheat and look from outside of git at the
symlink or file that is the OS-level implementation of HEAD), and the
branch doesn't appear in a log listing, etc. So this magic
dereference is transparent to the user; HEAD looks like a commit to
her.
Ah, wait ... the man page says differently (and this is what drives
me
nuts about the git doc).
Yeah, well, somebody whose favorite tool is something called "queue"
whose primary mode of operation is stack-like can't complain about
confusing docs. :-)
I have to admit that the git nomenclature seems designed to put off
newbies and people who "just want to use the tool dammit!"
You want to retroactively undo a commit, preserving the current
working tree, right? This is done by "hg strip" (part of MQ).
No, I don't want to undo the commit, at least to the extent I need to
replicate git behavior. I want to change hg's idea of what commit is
at the head of my current branch, without losing the commits I've
made. I'm not really sure what I actually need, just that everything
I try to do in hg seems either to be impossible or to pollute the
public namespace. :-P
That's easy, albeit without preserving identity. Easiest is
probably
with "hg transplant", but I suspect that "hg rebase" (which I
haven't
tried yet) also does this.
Do tags and branch points move too? I suspect not. (In git they
don't move when you rebase, but I don't use rebase to emulate patch
stacks in git.)
_______________________________________________
XEmacs-Beta mailing list
XEmacs-Beta(a)xemacs.org
http://calypso.tux.org/cgi-bin/mailman/listinfo/xemacs-beta