I upgraded Git a couple months ago and since then I\'ve been receiving the following deprecation notice upon attempting git add --update
:
The :/
notation evolves in git 2.8 (March 2016) with the '^{/!-
' notation: :/!-foo
See commit 0769854 (31 Jan 2016), and commit 06b6b68 (10 Jan 2016) by Will Palmer (wpalmer).
(Merged by Junio C Hamano -- gitster -- in commit fb79532, 10 Feb 2016)
To name a commit, you can now use the
:/!-
regex style, and consequentially, say
$ git rev-parse HEAD^{/!-foo}
and it will return the hash of the first commit reachable from HEAD, whose commit message does not contain "
foo
".
This is the opposite of the existingsyntax.
^{/ } The specific use-case this is intended for is to perform an operation, excluding the most-recent commits containing a particular marker.
For example, if you tend to make "work in progress" commits, with messages beginning with "WIP
", you work, then it could be useful to diff against "the most recent commit which was not aWIP
commit".
That sort of thing now possible, via commands such as:
$ git diff @^{/!-^WIP}
The leader '
/!-
', rather than simply '/!
', to denote a negative match, is chosen to leave room for additional modifiers in the future.
The new git/revisions doc now states:
To match messages starting with a string, one can use e.g. '
:/^foo
'.
The special sequence ':/!
' is reserved for modifiers to what is matched:
- '
:/!-foo
' performs a negative match,- while '
:/!!foo
' matches a literal '!' character, followed by 'foo'.- Any other sequence beginning with '
:/!
' is reserved for now.