Skip to content

Commit 79b57f1

Browse files
committed
Add List Branches That Contain A Commit as a git til
1 parent ee91d18 commit 79b57f1

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ and pairing with smart people at Hashrocket.
99

1010
For a steady stream of TILs, [sign up for my newsletter](https://tinyletter.com/jbranchaud).
1111

12-
_892 TILs and counting..._
12+
_893 TILs and counting..._
1313

1414
---
1515

@@ -215,6 +215,7 @@ _892 TILs and counting..._
215215
- [Interactively Unstage Changes](git/interactively-unstage-changes.md)
216216
- [Last Commit A File Appeared In](git/last-commit-a-file-appeared-in.md)
217217
- [List All Files Changed Between Two Branches](git/list-all-files-changed-between-two-branches.md)
218+
- [List Branches That Contain A Commit](git/list-branches-that-contain-a-commit.md)
218219
- [List Commits On A Branch](git/list-commits-on-a-branch.md)
219220
- [List Different Commits Between Two Branches](git/list-different-commits-between-two-branches.md)
220221
- [List Filenames Without The Diffs](git/list-filenames-without-the-diffs.md)
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# List Branches That Contain A Commit
2+
3+
You know a certain change made it onto the main branch. You'd like to know if
4+
that changes has been integrated back into the development and staging
5+
branches. If you have a specific git sha associated with that change, there is
6+
a handy way to check.
7+
8+
```bash
9+
$ git branch --contains 50e1151
10+
```
11+
12+
The `--contains` flag of the
13+
[`git-branch`](https://git-scm.com/docs/git-branch) command will list all
14+
branches locally that contain the given commit sha.
15+
16+
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.
17+
18+
See `man git-branch` for more details.

0 commit comments

Comments
 (0)