Thread (3 messages) 3 messages, 2 authors, 2016-06-15

Re: Editing the root commit

flat view

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:54:08

Chris Webb [off-list ref] writes:
The first is whether there's a clever symbolic way to refer to the root of
the current branch, rather than tailing git log output? gitrevisions(7)
doesn't obviously suggest one.
There is not, for a few good reasons.

The very first commit is no more special than any other commit in
the history.  Some projects may start with "the first working
version", in which case there may be some value to be able to refer
to it, while some other projects may start with "the initial
snapshot" whose specialness comes _only_ from it being the first
one.

"The first working version" specialness may deserve to be tagged,
and in that case you would already have a name to refer to it.  If
on the other hand the first one isn't even worth to be tagged, it
does not deserve to waste a short-hand to refer to it at the
machinery level.  So there is nothing listed in the gitrevisions(7)
for it.

Also there is a more important question: Which root commit?  There
does not necessarily have to be a single "the root" commit in the
history.
  git checkout --orphan rewritten
  git rm -rf
  git rebase --interactive --root --onto rewritten master
The argument to "--onto" must be a commit, but "checkout --orphan"
is not a way to create a commit; it is a way to bring you to a state
without any commit.

I personally think "git rebase -i --root" should be made to just
work without requiring "--onto" and let you "edit" even the first
one in the history. It is understandable that nobody bothered, as
people are a lot less often rewriting near the very beginning of the
history than otherwise.

Even though I wouldn't bother doing this myself, I wouldn't mind
reviewing a patch series ;-)
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help