Skip to contentSkip to conversation

Document the master@{n} reflog query syntax.

PATCH In review Shawn O. Pearce 3 participants 5 messages Jun 15, 2016 Documentation

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 Document the master@{n} reflog query syntax.

In ab2a1a32 Junio improved the reflog query logic to support obtaining the n-th prior value of a ref, but this was never documented in git-rev-parse. Now it is.

---
 Documentation/git-rev-parse.txt |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)
Documentation/git-rev-parse.txt +9 -1
index 4eaf5a0..7bfbe1b 100644
@@ -148,10 +148,18 @@ blobs contained in a commit.
   enclosed in a brace
   pair (e.g. '\{yesterday\}', '\{1 month 2 weeks 3 days 1 hour 1
   second ago\}' or '\{1979-02-26 18:30:00\}') to specify the value
-  of the ref at a prior point in time.  This suffix may only be
+  of the ref at a prior point in time.This suffix may only be
   used immediately following a ref name and the ref must have an
   existing log ($GIT_DIR/logs/<ref>).
 
+* A ref followed by the suffix '@' with an ordinal specification
+  enclosed in a brace pair (e.g. '\{1\}', '\{15\}') to specify
+  the n-th prior value of that ref.  For example 'master@\{1\}'
+  is the immediate prior value of 'master' while 'master@\{5\}'
+  is the 5th prior value of 'master'. This suffix may only be used
+  immediately following a ref name and the ref must have an existing
+  log ($GIT_DIR/logs/<ref>).
+
 * A suffix '{caret}' to a revision parameter means the first parent of
   that commit object.  '{caret}<n>' means the <n>th parent (i.e.
   'rev{caret}'
Signature · 1 line
1.5.0.rc1.g556b
#1 lore raw
Quoted 14 lines · Shawn O. Pearce

In ab2a1a32 Junio improved the reflog query logic to support obtaining the n-th prior value of a ref, but this was never documented in git-rev-parse. Now it is.

---
Documentation/git-rev-parse.txt | 10 +++++++++-

1 files changed, 9 insertions(+), 1 deletions(-)
Documentation/git-rev-parse.txt +0 -0
index 4eaf5a0..7bfbe1b 100644

Documentation/git-rev-parse.txt blobs contained in a commit. · line 151

Quoted 5 lines
Documentation/git-rev-parse.txt +1 -1
@@ -148,10 +148,18 @@ blobs contained in a commit.
  enclosed in a brace
  pair (e.g. '\{yesterday\}', '\{1 month 2 weeks 3 days 1 hour 1
  second ago\}' or '\{1979-02-26 18:30:00\}') to specify the value
-  of the ref at a prior point in time.  This suffix may only be
+  of the ref at a prior point in time.This suffix may only be

I'm guessing that the above was unintentional?

#2 lore raw
Quoted 5 lines · Jim Treadway

Documentation/git-rev-parse.txt blobs contained in a commit. · line 151

Quoted 2 lines · Shawn O. Pearce
Documentation/git-rev-parse.txt +1 -1
-  of the ref at a prior point in time.  This suffix may only be
+  of the ref at a prior point in time.This suffix may only be

I'm guessing that the above was unintentional?

Yes. Danngit. Junio, can you hand edit that patch?

Signature · 1 line
Shawn.
#3 lore raw
Quoted 8 lines · Shawn O. Pearce
Quoted 4 lines · Jim Treadway

Documentation/git-rev-parse.txt blobs contained in a commit. · line 151

Quoted 2 lines · Shawn O. Pearce
Documentation/git-rev-parse.txt +1 -1
-  of the ref at a prior point in time.  This suffix may only be
+  of the ref at a prior point in time.This suffix may only be

I'm guessing that the above was unintentional?

Yes. Danngit. Junio, can you hand edit that patch?

I'm starting to see --amend as an extremely useful thing to have, and I'm sure Junio thinks the same. For fixes this small, it sure is easier to just --amend the commit than to ask for a new patch to apply.

Out of curiousity, how many other SCM's allow you to --amend a commit?

Signature · 3 lines
Andreas Ericsson                   [email protected]
OP5 AB                             www.op5.se
Tel: +46 8-230225                  Fax: +46 8-230231
#4 lore raw
Quoted 5 lines · Andreas Ericsson
Quoted 4 lines · Shawn O. Pearce
Quoted 3 lines · Jim Treadway
Quoted 2 lines · Shawn O. Pearce
Documentation/git-rev-parse.txt +1 -1
-  of the ref at a prior point in time.  This suffix may only be
+  of the ref at a prior point in time.This suffix may only be
Quoted 8 lines
Quoted 4 lines
Quoted 1 line

I'm guessing that the above was unintentional?

Yes. Danngit. Junio, can you hand edit that patch?

I'm starting to see --amend as an extremely useful thing to have, and I'm sure Junio thinks the same. For fixes this small, it sure is easier to just --amend the commit than to ask for a new patch to apply.

I still shouldn't have let that change sneak into the diff. I know how it happened, I wanted to copy part of that line so I wiggled it around in vi, copied it, then hit undo. I didn't undo back far enough. Then I didn't read the diff closely enough before sending.

Quoted 1 line

Out of curiousity, how many other SCM's allow you to --amend a commit?

None that I know of.

Signature · 1 line
Shawn.