Date Spec
The Ref Log that git keeps will allow you to do some relative stuff locally, such as:
master@{yesterday}
master@{1 month ago}
Which is shorthand for 'where the master branch head was yesterday', etc. Note that this format can result in different shas on different computers, even if the master branch is currently pointing to the same place.
Ordinal Spec
This format will give you the Nth previous value of a particular reference. For example:
master@{5}
will give you the 5th prior value of the master head ref.
Carrot Parent
This will give you the Nth parent of a particular commit. This format is only useful on merge commits - commit objects that have more than one direct parent.
master^2
Tilde Spec
The tilde spec will give you the Nth grandparent of a commit object. For example,
master~2
will give us the first parent of the first parent of the commit that master points to. It is equivalent to:
master^^
You can keep doing this, too. The following specs will point to the same commit:
master^^^^^^
master~3^~2
master~6
No comments:
Post a Comment