You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: README.md
+50-16
Original file line number
Diff line number
Diff line change
@@ -1,25 +1,57 @@
1
-
Installation
2
-
------------
3
-
Clone the repo somewhere on your system.
4
-
Ensure that <somewhere>/bin/git-when-merged is executable.
5
-
Put the contents of <somewhere>/bin on your $PATH. That's it!
1
+
# `git when-merged`
6
2
7
-
Or using Homebrew:
3
+
`git when-merged` helps you figure out when and why a commit was merged into a branch.
8
4
5
+
If you use standard Git workflows, then you create a feature branch for each feature that you are working on. When the feature is complete, you merge it into your `master` branch. You might even have sub-feature branches that are merged into a feature branch before the latter is merged.
6
+
7
+
In such a workflow, the first-parent history of `master` consists mainly of merges of feature branches into the mainline. `git when-merged` can be used to ask, "When (and why) was commit C merged into the current branch?" The simplest way to use it is
This command looks along the first-parent history of the current branch to find the merge commit that first brought commit `87c248f` into the branch's history. The guilty merge commit in this case is `50f5774`. Add the `-l` option to see the log for that merge, which will hopefully explain what feature was being merged and by whom:
Merge pull request #9 from mhagger/recursive-option
25
+
26
+
Add a `--recursive`/`-r` option
9
27
```
28
+
29
+
There are many more options; see below.
30
+
31
+
32
+
## Installation
33
+
34
+
* Clone the repo somewhere on your system.
35
+
* Ensure that `<somewhere>/bin/git-when-merged` is executable.
36
+
* Put the contents of `<somewhere>/bin` on your `$PATH`.
37
+
38
+
That's it!
39
+
40
+
Or, using Homebrew:
41
+
42
+
```ShellSession
10
43
$ brew update
11
44
$ brew install git-when-merged
12
45
```
13
46
14
-
Usage
15
-
----------
16
-
git when-merged [OPTIONS] COMMIT [BRANCH...]
17
47
18
-
Find when a commit was merged into one or more branches. Find the merge
19
-
commit that brought COMMIT into the specified BRANCH(es). Specificially, look
20
-
for the oldest commit on the first-parent history of BRANCH that contains the
21
-
COMMIT as an ancestor.
48
+
## Usage
49
+
50
+
git when-merged [OPTIONS] COMMIT [BRANCH...]
22
51
52
+
Find the merge commit that brought `COMMIT` into the specified `BRANCH`(es). Specifically, look for the oldest commit on the first-parent history of each `BRANCH` that contains the `COMMIT` as an ancestor.
53
+
54
+
```
23
55
Options:
24
56
-h, --help show this help message and exit
25
57
-p PATTERN, --pattern=PATTERN
@@ -61,7 +93,8 @@ Examples:
61
93
git when-merged 0a1b -r feature-1 # If merged indirectly, show all
62
94
# merges involved.
63
95
64
-
git when-merged 0a1b -d feature-1 # Show diff for each merge commit
96
+
git when-merged 0a1b -l feature-1 # Show log for the merge commit
97
+
git when-merged 0a1b -d feature-1 # Show diff for the merge commit
abbreviated to this number of characters (or longer if needed to
88
121
avoid ambiguity). This value can be overridden using --abbrev=N
89
122
or --no-abbrev.
123
+
```
124
+
125
+
`git when-merged` is originally based on [the suggestion here](http://stackoverflow.com/questions/8475448/find-merge-commit-which-include-a-specific-commit).
0 commit comments