diff --git a/README.md b/README.md index 862b4d7..23f2243 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ and pairing with smart people at Hashrocket. For a steady stream of TILs, [sign up for my newsletter](https://tinyletter.com/jbranchaud). -_892 TILs and counting..._ +_893 TILs and counting..._ --- @@ -215,6 +215,7 @@ _892 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 Branches That Contain A Commit](git/list-branches-that-contain-a-commit.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) diff --git a/git/list-branches-that-contain-a-commit.md b/git/list-branches-that-contain-a-commit.md new file mode 100644 index 0000000..232a25b --- /dev/null +++ b/git/list-branches-that-contain-a-commit.md @@ -0,0 +1,18 @@ +# List Branches That Contain A Commit + +You know a certain change made it onto the main branch. You'd like to know if +that changes has been integrated back into the development and staging +branches. If you have a specific git sha associated with that change, there is +a handy way to check. + +```bash +$ git branch --contains 50e1151 +``` + +The `--contains` flag of the +[`git-branch`](https://git-scm.com/docs/git-branch) command will list all +branches locally that contain the given commit sha. + +If you don't see any output, then no branches have that sha. This means either there are remote changes that you need to pull down or you're looking at the wrong repo. + +See `man git-branch` for more details.