diff --git a/README.md b/README.md index 03befad..151fb85 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ smart people at [Hashrocket](http://hashrocket.com/). For a steady stream of TILs from a variety of rocketeers, checkout [til.hashrocket.com](https://til.hashrocket.com/). -_834 TILs and counting..._ +_835 TILs and counting..._ --- @@ -232,6 +232,7 @@ _834 TILs and counting..._ - [Stashing Only Unstaged Changes](git/stashing-only-unstaged-changes.md) - [Stashing Untracked Files](git/stashing-untracked-files.md) - [Switch To A Recent Branch With FZF](git/switch-to-a-recent-branch-with-fzf.md) +- [Two Kinds Of Dotted Range Notation](git/two-kinds-of-dotted-range-notation.md) - [Untrack A Directory Of Files Without Deleting](git/untrack-a-directory-of-files-without-deleting.md) - [Untrack A File Without Deleting It](git/untrack-a-file-without-deleting-it.md) - [Update The URL Of A Remote](git/update-the-url-of-a-remote.md) diff --git a/git/two-kinds-of-dotted-range-notation.md b/git/two-kinds-of-dotted-range-notation.md new file mode 100644 index 0000000..2986aa1 --- /dev/null +++ b/git/two-kinds-of-dotted-range-notation.md @@ -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)