diff --git a/snippets/branches-containing-commit.md b/snippets/branches-containing-commit.md new file mode 100644 index 000000000..58c4ce6ba --- /dev/null +++ b/snippets/branches-containing-commit.md @@ -0,0 +1,18 @@ +--- +title: Find branches containing a commit +tags: branch,commit,beginner +--- + +Prints all the branches containing a specific commit. + +- Use `git branch --contains ` to see a list of all branches containing ``. + +```sh +git branch --contains +``` + +```sh +git branch --contains 3050fc0d3 +# patch-1 +# patch-2 +``` diff --git a/snippets/branches-not-containing-commit.md b/snippets/branches-not-containing-commit.md new file mode 100644 index 000000000..e6cffc3e1 --- /dev/null +++ b/snippets/branches-not-containing-commit.md @@ -0,0 +1,18 @@ +--- +title: Find branches not containing a commit +tags: branch,commit,beginner +--- + +Prints all the branches not containing a specific commit. + +- Use `git branch --no-contains ` to see a list of all branches not containing ``. + +```sh +git branch --no-contains +``` + +```sh +git branch --no-contains 3050fc0d3 +# patch-3 +# patch-4 +```