1
0
mirror of https://github.com/jbranchaud/til synced 2026-01-03 23:28:02 +00:00

Add Two Kinds Of Dotted Range Notation as a git til

This commit is contained in:
jbranchaud
2019-08-13 13:31:49 -05:00
parent 9c9c8a5f23
commit d40a96d534
2 changed files with 37 additions and 1 deletions

View File

@@ -0,0 +1,35 @@
# Two Kinds Of Dotted Range Notation
There are two kinds of dotted range notation in git -- `..` and `...`.
If you'd like to view all changes on your current feature branch since checking
out from `master`, you can use the two-dot notation:
```bash
git log master..some-feature-branch --oneline
9e50bff (some-feature-branch) Add second feature change
b11bb0b Add first feature change
```
You could also switch the refs around to see what has changed on master since
checking out:
```bash
git log some-feature-branch..master --oneline
c2880f8 (HEAD -> master) Add description to README
```
Then there is the three-dot notation. This will include all commits from the
second ref that aren't in the first and all commits in the first that aren't in
the second.
```bash
git log master...some-feature-branch --oneline
c2880f8 (HEAD -> master) Add description to README
9e50bff (some-feature-branch) Add second feature change
b11bb0b Add first feature change
```
See `man git-rev-parse` for more details.
[source](https://stackoverflow.com/a/24186641/535590)