Skip to content

Commit d40a96d

Browse files
committed
Add Two Kinds Of Dotted Range Notation as a git til
1 parent 9c9c8a5 commit d40a96d

File tree

2 files changed

+37
-1
lines changed

2 files changed

+37
-1
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ smart people at [Hashrocket](http://hashrocket.com/).
1010
For a steady stream of TILs from a variety of rocketeers, checkout
1111
[til.hashrocket.com](https://til.hashrocket.com/).
1212

13-
_834 TILs and counting..._
13+
_835 TILs and counting..._
1414

1515
---
1616

@@ -232,6 +232,7 @@ _834 TILs and counting..._
232232
- [Stashing Only Unstaged Changes](git/stashing-only-unstaged-changes.md)
233233
- [Stashing Untracked Files](git/stashing-untracked-files.md)
234234
- [Switch To A Recent Branch With FZF](git/switch-to-a-recent-branch-with-fzf.md)
235+
- [Two Kinds Of Dotted Range Notation](git/two-kinds-of-dotted-range-notation.md)
235236
- [Untrack A Directory Of Files Without Deleting](git/untrack-a-directory-of-files-without-deleting.md)
236237
- [Untrack A File Without Deleting It](git/untrack-a-file-without-deleting-it.md)
237238
- [Update The URL Of A Remote](git/update-the-url-of-a-remote.md)
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Two Kinds Of Dotted Range Notation
2+
3+
There are two kinds of dotted range notation in git -- `..` and `...`.
4+
5+
If you'd like to view all changes on your current feature branch since checking
6+
out from `master`, you can use the two-dot notation:
7+
8+
```bash
9+
❯ git log master..some-feature-branch --oneline
10+
9e50bff (some-feature-branch) Add second feature change
11+
b11bb0b Add first feature change
12+
```
13+
14+
You could also switch the refs around to see what has changed on master since
15+
checking out:
16+
17+
```bash
18+
❯ git log some-feature-branch..master --oneline
19+
c2880f8 (HEAD -> master) Add description to README
20+
```
21+
22+
Then there is the three-dot notation. This will include all commits from the
23+
second ref that aren't in the first and all commits in the first that aren't in
24+
the second.
25+
26+
```bash
27+
❯ git log master...some-feature-branch --oneline
28+
c2880f8 (HEAD -> master) Add description to README
29+
9e50bff (some-feature-branch) Add second feature change
30+
b11bb0b Add first feature change
31+
```
32+
33+
See `man git-rev-parse` for more details.
34+
35+
[source](https://stackoverflow.com/a/24186641/535590)

0 commit comments

Comments
 (0)