From a96061356a1b7273f34eb925a034dbb0d99759e7 Mon Sep 17 00:00:00 2001 From: jbranchaud Date: Thu, 21 Mar 2019 17:03:04 -0500 Subject: [PATCH] Add List Commits On A Branch as a git til --- README.md | 3 ++- git/list-commits-on-a-branch.md | 20 ++++++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 git/list-commits-on-a-branch.md diff --git a/README.md b/README.md index 097744e..11f9515 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/). -_792 TILs and counting..._ +_793 TILs and counting..._ --- @@ -200,6 +200,7 @@ _792 TILs and counting..._ - [Interactively Unstage Changes](git/interactively-unstage-changes.md) - [Last Commit A File Appeared In](git/last-commit-a-file-appeared-in.md) - [List All Files Changed Between Two Branches](git/list-all-files-changed-between-two-branches.md) +- [List Commits On A Branch](git/list-commits-on-a-branch.md) - [List Different Commits Between Two Branches](git/list-different-commits-between-two-branches.md) - [List Filenames Without The Diffs](git/list-filenames-without-the-diffs.md) - [List Most Git Commands](git/list-most-git-commands.md) diff --git a/git/list-commits-on-a-branch.md b/git/list-commits-on-a-branch.md new file mode 100644 index 0000000..5741b9e --- /dev/null +++ b/git/list-commits-on-a-branch.md @@ -0,0 +1,20 @@ +# List Commits On A Branch + +You can list all commits that have taken place since a branch split off from +another branch using `git log`. You just need to specify a ref range with +the originating branch and the branch of interest. + +```bash +$ git log master..my-feature-branch +``` + +That will list all commits on `my-feature-branch` since it branched off from +`master`. + +I like to tighten up the output a bit with a flag: + +```bash +$ git log master..my-feature-branch --oneline +``` + +See `man git-log` for more details.