Skip to content

Commit 5b8e368

Browse files
authored
Merge pull request #10 from mhagger/readme-markdown
Convert the README file to markdown
2 parents 50f5774 + f47f7d3 commit 5b8e368

File tree

2 files changed

+52
-18
lines changed

2 files changed

+52
-18
lines changed

README README.md

+50-16
Original file line numberDiff line numberDiff 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`
62

7-
Or using Homebrew:
3+
`git when-merged` helps you figure out when and why a commit was merged into a branch.
84

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
8+
9+
```ShellSession
10+
$ git when-merged 87c248f
11+
refs/heads/master 50f577451448a407ee8e78ed62aa09d209c91652
12+
```
13+
14+
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:
15+
16+
```ShellSession
17+
$ git when-merged -l 87c248f
18+
refs/heads/master 50f577451448a407ee8e78ed62aa09d209c91652
19+
commit 50f577451448a407ee8e78ed62aa09d209c91652 (github/master, master)
20+
Merge: f79a45d 87c248f
21+
Author: Michael Haggerty <[email protected]>
22+
Date: Mon Jul 11 07:55:19 2016 +0200
23+
24+
Merge pull request #9 from mhagger/recursive-option
25+
26+
Add a `--recursive`/`-r` option
927
```
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
1043
$ brew update
1144
$ brew install git-when-merged
1245
```
1346

14-
Usage
15-
----------
16-
git when-merged [OPTIONS] COMMIT [BRANCH...]
1747

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...]
2251

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+
```
2355
Options:
2456
-h, --help show this help message and exit
2557
-p PATTERN, --pattern=PATTERN
@@ -61,7 +93,8 @@ Examples:
6193
git when-merged 0a1b -r feature-1 # If merged indirectly, show all
6294
# merges involved.
6395
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
6598
git when-merged 0a1b -v feature-1 # Display merge commit in gitk
6699
67100
Configuration:
@@ -87,6 +120,7 @@ Configuration:
87120
abbreviated to this number of characters (or longer if needed to
88121
avoid ambiguity). This value can be overridden using --abbrev=N
89122
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).
90126

91-
Based on:
92-
http://stackoverflow.com/questions/8475448/find-merge-commit-which-include-a-specific-commit

bin/git-when-merged

+2-2
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@
2222
"""Find when a commit was merged into one or more branches.
2323
2424
Find the merge commit that brought COMMIT into the specified
25-
BRANCH(es). Specificially, look for the oldest commit on the
26-
first-parent history of BRANCH that contains the COMMIT as an
25+
BRANCH(es). Specifically, look for the oldest commit on the
26+
first-parent history of each BRANCH that contains the COMMIT as an
2727
ancestor.
2828
2929
"""

0 commit comments

Comments
 (0)