File tree 2 files changed +33
-0
lines changed
2 files changed +33
-0
lines changed Original file line number Diff line number Diff line change @@ -76,6 +76,7 @@ smart people at [Hashrocket](http://hashrocket.com/).
76
76
- [ List Filenames Without The Diffs] ( git/list-filenames-without-the-diffs.md )
77
77
- [ List Untracked Files] ( git/list-untracked-files.md )
78
78
- [ Move The Latest Commit To A New Branch] ( git/move-the-latest-commit-to-a-new-branch.md )
79
+ - [ Reference A Commit Via Commit Message Pattern Matching] ( git/reference-a-commit-via-commit-message-pattern-matching.md )
79
80
- [ Renaming A Branch] ( git/renaming-a-branch.md )
80
81
- [ Resetting A Reset] ( git/resetting-a-reset.md )
81
82
- [ Single Key Presses in Interactive Mode] ( git/single-key-presses-in-interactive-mode.md )
Original file line number Diff line number Diff line change
1
+ # Reference A Commit Via Commit Message Pattern Matching
2
+
3
+ Generally when referencing a commit, you'll use the SHA or a portion of the
4
+ SHA. For example with ` git-show ` :
5
+
6
+ ```
7
+ $ git show cd6a63d014
8
+ ...
9
+ ```
10
+
11
+ There are many ways to reference commits though. One way is via regex
12
+ pattern matching on the commit message. For instance, if you recently had a
13
+ commit with a typo and you had included * typo* in the commit message, then
14
+ you could reference that commit like so:
15
+
16
+ ```
17
+ $ git show :/typo
18
+ Author: Josh Branchaud
19
+ Date: Mon Dec 21 15:50:20 2015 -0600
20
+
21
+ Fix a typo in the documentation
22
+ ...
23
+ ```
24
+
25
+ By using ` :/ ` followed by some text, git will attempt to find the most
26
+ recent commit whose commit message matches the text. As I alluded to, regex
27
+ can be used in the text.
28
+
29
+ See ` $ man gitrevisions ` for more details and other ways to reference
30
+ commits.
31
+
32
+ [ Source] ( https://twitter.com/jamesfublo/status/678906346335428608 )
You can’t perform that action at this time.
0 commit comments