git_reflow 0.8.9 → 0.8.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.gitignore +1 -0
- data/.ruby-version +1 -0
- data/Gemfile.lock +41 -44
- data/README.md +461 -0
- data/_config.yml +1 -0
- data/circle.yml +5 -5
- data/exe/git-reflow +36 -36
- data/git_reflow.gemspec +6 -11
- data/lib/git_reflow.rb +0 -1
- data/lib/git_reflow/git_server.rb +63 -63
- data/lib/git_reflow/git_server/bit_bucket.rb +101 -101
- data/lib/git_reflow/git_server/bit_bucket/pull_request.rb +84 -84
- data/lib/git_reflow/git_server/git_hub.rb +1 -1
- data/lib/git_reflow/git_server/git_hub/pull_request.rb +1 -1
- data/lib/git_reflow/rspec.rb +2 -2
- data/lib/git_reflow/version.rb +1 -1
- data/lib/git_reflow/workflows/core.rb +235 -238
- data/lib/git_reflow/workflows/flat_merge.rb +10 -10
- data/spec/fixtures/awesome_workflow.rb +7 -7
- data/spec/fixtures/workflow_with_super.rb +8 -8
- data/spec/lib/git_reflow/git_server/bit_bucket_spec.rb +81 -81
- data/spec/lib/git_reflow/git_server/git_hub/pull_request_spec.rb +4 -4
- data/spec/lib/git_reflow/git_server_spec.rb +101 -101
- data/spec/lib/git_reflow/sandbox_spec.rb +1 -1
- data/spec/lib/git_reflow/workflow_spec.rb +59 -59
- data/spec/lib/git_reflow/workflows/core_spec.rb +3 -4
- data/spec/lib/git_reflow/workflows/flat_merge_spec.rb +60 -59
- data/spec/support/fixtures.rb +54 -54
- data/spec/support/github_helpers.rb +99 -109
- metadata +17 -39
- data/README.rdoc +0 -461
- data/lib/git_reflow/os_detector.rb +0 -23
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 7cb152969ba643f598484003a83a2b42bce63c597e51166d0e8791669f424d0a
|
4
|
+
data.tar.gz: 3f2d023a80898c5805cca38381dfaa844a31503475c7ef32d8e8382731bcc3f6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f722fe8ac62dc861fca2cee9c63e1c28793c8ef38b6a767183574a55a43613ceb99005bac5e2742f8824ee9ef449db29135a125879f565f48a46236c231aa88f
|
7
|
+
data.tar.gz: 7253ca5d6fca4cbc0242d0b3bf2541dc963913a2fe09dd7c7f520becef27bcdb4a6355b85c3d248d248a57916e299167050559380f8376739e9dcf2feba19eae
|
data/.gitignore
CHANGED
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
2.5.1
|
data/Gemfile.lock
CHANGED
@@ -1,26 +1,25 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
git_reflow (0.8.
|
4
|
+
git_reflow (0.8.10)
|
5
5
|
colorize (>= 0.7.0)
|
6
6
|
github_api (= 0.15.0)
|
7
|
-
gli (= 2.
|
7
|
+
gli (= 2.17.0)
|
8
8
|
highline
|
9
9
|
httpclient
|
10
|
-
rack (>= 1.2, < 2)
|
11
10
|
reenhanced_bitbucket_api (= 0.3.2)
|
12
11
|
|
13
12
|
GEM
|
14
13
|
remote: https://rubygems.org/
|
15
14
|
specs:
|
16
15
|
addressable (2.4.0)
|
17
|
-
appraisal (2.
|
16
|
+
appraisal (2.2.0)
|
18
17
|
bundler
|
19
18
|
rake
|
20
19
|
thor (>= 0.14.0)
|
21
|
-
byebug (
|
20
|
+
byebug (10.0.2)
|
22
21
|
chronic (0.10.2)
|
23
|
-
coderay (1.1.
|
22
|
+
coderay (1.1.2)
|
24
23
|
colorize (0.8.1)
|
25
24
|
crack (0.4.3)
|
26
25
|
safe_yaml (~> 1.0.0)
|
@@ -38,36 +37,35 @@ GEM
|
|
38
37
|
hashie (>= 3.4)
|
39
38
|
mime-types (>= 1.16, < 3.0)
|
40
39
|
oauth2 (~> 1.0)
|
41
|
-
gli (2.
|
42
|
-
hashdiff (0.3.
|
43
|
-
hashie (3.5.
|
44
|
-
highline (1.7.
|
40
|
+
gli (2.17.0)
|
41
|
+
hashdiff (0.3.7)
|
42
|
+
hashie (3.5.7)
|
43
|
+
highline (1.7.10)
|
45
44
|
httpclient (2.8.3)
|
46
45
|
jwt (1.5.6)
|
47
|
-
method_source (0.
|
46
|
+
method_source (0.9.0)
|
48
47
|
mime-types (2.99.3)
|
49
|
-
mini_portile2 (2.
|
50
|
-
multi_json (1.
|
48
|
+
mini_portile2 (2.3.0)
|
49
|
+
multi_json (1.13.1)
|
51
50
|
multi_xml (0.6.0)
|
52
51
|
multipart-post (2.0.0)
|
53
|
-
nokogiri (1.
|
54
|
-
mini_portile2 (~> 2.
|
55
|
-
oauth2 (1.
|
56
|
-
faraday (>= 0.8, < 0.
|
52
|
+
nokogiri (1.8.2)
|
53
|
+
mini_portile2 (~> 2.3.0)
|
54
|
+
oauth2 (1.4.0)
|
55
|
+
faraday (>= 0.8, < 0.13)
|
57
56
|
jwt (~> 1.0)
|
58
57
|
multi_json (~> 1.3)
|
59
58
|
multi_xml (~> 0.5)
|
60
59
|
rack (>= 1.2, < 3)
|
61
|
-
pry (0.
|
60
|
+
pry (0.11.3)
|
62
61
|
coderay (~> 1.1.0)
|
63
|
-
method_source (~> 0.
|
64
|
-
|
65
|
-
|
66
|
-
byebug (~> 9.0)
|
62
|
+
method_source (~> 0.9.0)
|
63
|
+
pry-byebug (3.6.0)
|
64
|
+
byebug (~> 10.0)
|
67
65
|
pry (~> 0.10)
|
68
|
-
rack (
|
69
|
-
rake (
|
70
|
-
rdoc (
|
66
|
+
rack (2.0.4)
|
67
|
+
rake (12.3.1)
|
68
|
+
rdoc (6.0.3)
|
71
69
|
reenhanced_bitbucket_api (0.3.2)
|
72
70
|
faraday (~> 0.9.0)
|
73
71
|
faraday_middleware (~> 0.9.0)
|
@@ -75,25 +73,24 @@ GEM
|
|
75
73
|
multi_json (>= 1.7.5, < 2.0)
|
76
74
|
nokogiri (>= 1.5.2)
|
77
75
|
simple_oauth (>= 0.3.0)
|
78
|
-
rspec (3.
|
79
|
-
rspec-core (~> 3.
|
80
|
-
rspec-expectations (~> 3.
|
81
|
-
rspec-mocks (~> 3.
|
82
|
-
rspec-core (3.
|
83
|
-
rspec-support (~> 3.
|
84
|
-
rspec-expectations (3.
|
76
|
+
rspec (3.7.0)
|
77
|
+
rspec-core (~> 3.7.0)
|
78
|
+
rspec-expectations (~> 3.7.0)
|
79
|
+
rspec-mocks (~> 3.7.0)
|
80
|
+
rspec-core (3.7.1)
|
81
|
+
rspec-support (~> 3.7.0)
|
82
|
+
rspec-expectations (3.7.0)
|
85
83
|
diff-lcs (>= 1.2.0, < 2.0)
|
86
|
-
rspec-support (~> 3.
|
87
|
-
rspec-mocks (3.
|
84
|
+
rspec-support (~> 3.7.0)
|
85
|
+
rspec-mocks (3.7.0)
|
88
86
|
diff-lcs (>= 1.2.0, < 2.0)
|
89
|
-
rspec-support (~> 3.
|
90
|
-
rspec-support (3.
|
87
|
+
rspec-support (~> 3.7.0)
|
88
|
+
rspec-support (3.7.1)
|
91
89
|
safe_yaml (1.0.4)
|
92
90
|
simple_oauth (0.3.1)
|
93
|
-
|
94
|
-
thor (0.19.4)
|
91
|
+
thor (0.20.0)
|
95
92
|
thread_safe (0.3.6)
|
96
|
-
webmock (
|
93
|
+
webmock (3.3.0)
|
97
94
|
addressable (>= 2.3.6)
|
98
95
|
crack (>= 0.3.2)
|
99
96
|
hashdiff
|
@@ -103,16 +100,16 @@ PLATFORMS
|
|
103
100
|
ruby
|
104
101
|
|
105
102
|
DEPENDENCIES
|
106
|
-
appraisal (= 2.
|
107
|
-
bundler (~> 1.
|
103
|
+
appraisal (= 2.2.0)
|
104
|
+
bundler (~> 1.16)
|
108
105
|
chronic
|
109
106
|
git_reflow!
|
110
107
|
pry-byebug
|
111
|
-
rake (~>
|
108
|
+
rake (~> 12.3)
|
112
109
|
rdoc
|
113
|
-
rspec (~> 3.
|
110
|
+
rspec (~> 3.7.0)
|
114
111
|
webmock
|
115
112
|
wwtd (= 1.3.0)
|
116
113
|
|
117
114
|
BUNDLED WITH
|
118
|
-
1.
|
115
|
+
1.16.1
|
data/README.md
ADDED
@@ -0,0 +1,461 @@
|
|
1
|
+
<h1>
|
2
|
+
git-reflow – Automate your git workflow<br/>
|
3
|
+
<small><em>(2015 Fukuoka Ruby Award Winner)</em></small>
|
4
|
+
</h1>
|
5
|
+
|
6
|
+
<p>
|
7
|
+
<a href="https://circleci.com/gh/reenhanced/git-reflow/tree/master" title="current build status">
|
8
|
+
<img alt="Circle CI" src="https://circleci.com/gh/reenhanced/gitreflow.svg?style=svg&circle-token=d94825c17c7e33558dc2a82b37afad7b558e5a12">
|
9
|
+
</a>
|
10
|
+
<a href="https://github.com/reenhanced/gitreflow" title="git workflow">
|
11
|
+
<img alt="Git workflow powered by git-reflow" src="https://img.shields.io/badge/git--reflow-v0.8.10-blue.svg?style=flat">
|
12
|
+
</a>
|
13
|
+
<a href="http://inch-ci.org/github/reenhanced/gitreflow" title="documentation coverage">
|
14
|
+
<img src="http://inch-ci.org/github/reenhanced/gitreflow.svg?branch=master&style=shields" alt="Git-Reflow Documentation" />
|
15
|
+
</a>
|
16
|
+
</p>
|
17
|
+
|
18
|
+
* [Usage Overview](#usage-overview)
|
19
|
+
* [Getting Started](#getting-started)
|
20
|
+
* [Documentation](http://www.rubydoc.info/gems/git_reflow)
|
21
|
+
* [Guiding Priciples](#guiding-priciples)
|
22
|
+
|
23
|
+
![git-reflow deliver](http://reenhanced.com/reflow/git-reflow-deliver.gif)
|
24
|
+
|
25
|
+
If your workflow looks like this:
|
26
|
+
1. Create a feature branch
|
27
|
+
2. Write great code
|
28
|
+
3. Create a pull request against master
|
29
|
+
4. Get 'lgtm' through a code review
|
30
|
+
5. Merge to master (squashed by default, but can be overridden; [why we prefer squash-merge](https://github.com/reenhanced/gitreflow/issues/52))
|
31
|
+
6. Delete the feature branch
|
32
|
+
|
33
|
+
Reflow will make your life easier.
|
34
|
+
|
35
|
+
Reflow automatically creates pull requests, ensures the code review is approved, and merges finished branches to master with a great commit message template.
|
36
|
+
|
37
|
+
## Usage Overview
|
38
|
+
Create and switch to new branch `nh-branchy-branch`:
|
39
|
+
```
|
40
|
+
$ git reflow start nh-branchy-branch
|
41
|
+
```
|
42
|
+
Create a pull request for your branch against `master` or a custom `base-branch`:
|
43
|
+
```
|
44
|
+
$ git reflow review
|
45
|
+
```
|
46
|
+
If your code is approved, merge to `base-branch` and delete the feature branch:
|
47
|
+
```
|
48
|
+
$ git reflow deliver
|
49
|
+
```
|
50
|
+
|
51
|
+
----
|
52
|
+
|
53
|
+
## Benefits
|
54
|
+
* Enforce code reviews across your team.
|
55
|
+
* Know that your entire team delivers code the same way.
|
56
|
+
* Reduce the knowledge needed to deliver great code.
|
57
|
+
* Have a commit history that's clean and actually usable.
|
58
|
+
* Revert features with ease (if needed).
|
59
|
+
* Work with diverse teams with less worry about different processes.
|
60
|
+
* Stop searching for other git workflows.
|
61
|
+
Reflow covers 90% of your needs without junk you'll never use.
|
62
|
+
|
63
|
+
## Features
|
64
|
+
* Automatically create pull requests to master
|
65
|
+
* Automatically ensure that your code is reviewed before merging
|
66
|
+
* Start with sensible commit messages by default
|
67
|
+
* Squash merge feature branches because results are more important than details
|
68
|
+
* Automatically clean up obsolete feature branches after a successful merge
|
69
|
+
|
70
|
+
----
|
71
|
+
|
72
|
+
### Prerequisites
|
73
|
+
|
74
|
+
**Editor** When reviewing the title and body for a new pull request, or reviewing
|
75
|
+
the commit message when delivering a feature, we will open a temporary file with
|
76
|
+
your default editor. We will use git's chosen editor first (`git config core.editor`),
|
77
|
+
then we try your `EDITOR` environment variable, and lastly we fallback on "vim".
|
78
|
+
If you would like to use an editor of your choice, we recommend setting it with
|
79
|
+
git's config. As an example, to use Atom as your editor for all git commands:
|
80
|
+
|
81
|
+
```
|
82
|
+
$ git config --global core.editor "atom --wait"
|
83
|
+
```
|
84
|
+
|
85
|
+
See GitHub's full article on [associating text editors with Git](https://help.github.com/articles/associating-text-editors-with-git/) for more information on adding this.
|
86
|
+
|
87
|
+
|
88
|
+
## Getting Started
|
89
|
+
On your first install, you'll need to setup your Github credentials. These are used only to get an OAuth token that we will store in a reflow-specific git config file.
|
90
|
+
We use this token so we can create pull requests from the command line.
|
91
|
+
|
92
|
+
```
|
93
|
+
$ gem install git_reflow
|
94
|
+
|
95
|
+
... installs gem ...
|
96
|
+
|
97
|
+
$ git reflow setup
|
98
|
+
Please enter your GitHub username: nhance
|
99
|
+
Please enter your GitHub password (we do NOT store this):
|
100
|
+
|
101
|
+
Your GitHub account was successfully setup!
|
102
|
+
```
|
103
|
+
|
104
|
+
This is safe to run multiple times. We don't care. We save this information in a
|
105
|
+
special git configuration file (`~/.gitconfig.reflow`) that get's included into
|
106
|
+
your global `~/.gitconfig` file.
|
107
|
+
|
108
|
+
For usage with Github Enterprise, or other custom configurations, see our [Advanced Usage Guide](https://github.com/reenhanced/gitreflow/wiki/Advanced-Usage).
|
109
|
+
|
110
|
+
|
111
|
+
### Starting a feature branch
|
112
|
+
![git reflow start](http://reenhanced.com/reflow/git-reflow-start.gif)
|
113
|
+
|
114
|
+
This sets up a feature branch remotely and brings a local copy to your machine. Yeah, you can do this by hand pretty easily, so skip this command if you want. This is just a handy shortcut with no magic.
|
115
|
+
|
116
|
+
git reflow start nh-branch-name
|
117
|
+
|
118
|
+
`git reflow start` takes in the name of the new branch name that you want to create your feature on.
|
119
|
+
In addition, it takes in an optional flag of a _base-branch_ name (`--base`). If you don't pass in this parameter,
|
120
|
+
then it defaults to "master". The base branch name is the base branch that you want to base your feature off of.
|
121
|
+
This ensures that every time you start a new base branch, it will be based off of your latest remote base.
|
122
|
+
|
123
|
+
git reflow start nh-branch-name --base base-branch-name
|
124
|
+
|
125
|
+
> **[PROTIP]** Use your initials at the beginning of each branch so your team knows
|
126
|
+
who is responsible for each. My initials are `N.H.`, so all of my branches start with `nh-`
|
127
|
+
|
128
|
+
### Refreshing your current branch based on your base branch
|
129
|
+
```
|
130
|
+
git reflow refresh
|
131
|
+
```
|
132
|
+
|
133
|
+
This command updates your **feature-branch** and **base-branch** according to the **remote-location** and then merges your **base-branch** into your **feature-branch**. This is just a handy command to keep your branches up to date at any point in time if someone else has committed to the base-branch or the remote.
|
134
|
+
```
|
135
|
+
git reflow refresh -r <remote-location> -b <base-branch>
|
136
|
+
```
|
137
|
+
|
138
|
+
You pass in the name of the remote to fetch from and the name of the **base-branch** that you would like to merge into your **feature-branch**. The **remote-location** defaults to `origin` and the base-branch defaults to `master`. This command also takes in remote and branch name as flag options.
|
139
|
+
|
140
|
+
### Reviewing your work
|
141
|
+
![git reflow review](http://reenhanced.com/reflow/git-reflow-review.gif)
|
142
|
+
```
|
143
|
+
git reflow review
|
144
|
+
```
|
145
|
+
|
146
|
+
All of our work is reviewed by our team. This helps spread knowledge to multiple parties and keeps the quality of our code consistent.
|
147
|
+
|
148
|
+
The `review` step creates a pull request for the currently checked out feature branch against master. That's all you want to do most of the time.
|
149
|
+
We assume you know what you're doing, so if you need something different, do it by hand.
|
150
|
+
|
151
|
+
After making commits to your branch, run `review`. Didn't push it up? No problem, we'll do it for you.
|
152
|
+
```
|
153
|
+
git reflow review -t <title> -m <message>
|
154
|
+
```
|
155
|
+
> **Note:** `-t` and `-m` are optional.
|
156
|
+
|
157
|
+
If you do not pass the title or message options to the review command, you will be given an editor to write your PR request commit message, similar to `git commit`. The first line is the title, the rest is the body.
|
158
|
+
|
159
|
+
```
|
160
|
+
$ git reflow review
|
161
|
+
|
162
|
+
Review your PR:
|
163
|
+
--------
|
164
|
+
Title:
|
165
|
+
rj_209_test
|
166
|
+
|
167
|
+
Body:
|
168
|
+
[lib] updates review command to address issues
|
169
|
+
--------
|
170
|
+
Submit pull request? (Y): <enter>
|
171
|
+
git fetch origin master
|
172
|
+
From github.com:meesterdude/gitreflow
|
173
|
+
* branch master -> FETCH_HEAD
|
174
|
+
|
175
|
+
git push origin rj_test
|
176
|
+
Everything up-to-date
|
177
|
+
|
178
|
+
Successfully created pull request #6: rj_test
|
179
|
+
Pull Request URL: https://github.com/meesterdude/gitreflow/pull/6
|
180
|
+
Would you like to push this branch to your remote repo and cleanup your feature branch? y<enter>
|
181
|
+
```
|
182
|
+
|
183
|
+
We output the pull request URL so you can distribute it to your team.
|
184
|
+
|
185
|
+
#### How it works
|
186
|
+
Behind the scenes, this is how `review` works:
|
187
|
+
```
|
188
|
+
git fetch origin
|
189
|
+
```
|
190
|
+
|
191
|
+
Are we up-to-date with changes from master?
|
192
|
+
If not, fail with "master has newer changes".
|
193
|
+
|
194
|
+
Then,
|
195
|
+
```
|
196
|
+
git push origin current-branch # Updates remote branch
|
197
|
+
```
|
198
|
+
|
199
|
+
Do we have pull request?
|
200
|
+
If not, create it and print "Pull request created at http://pull-url/". If so, print the url for the existing request.
|
201
|
+
|
202
|
+
### Checking your branch status
|
203
|
+
![git reflow status](http://reenhanced.com/reflow/git-reflow-status.gif)
|
204
|
+
```
|
205
|
+
git reflow status
|
206
|
+
```
|
207
|
+
|
208
|
+
Sometimes you start working on a branch and can't get back to it for a while. It happens. Use +status+ to check on the status of your work.
|
209
|
+
|
210
|
+
```
|
211
|
+
$ git reflow status
|
212
|
+
|
213
|
+
Here's the status of your review:
|
214
|
+
branches: reenhanced:nh-readme-update -> reenhanced:master
|
215
|
+
number: 35
|
216
|
+
reviewed by:
|
217
|
+
url: https://github.com/reenhanced/gitreflow/pull/35
|
218
|
+
|
219
|
+
[notice] No one has reviewed your pull request.
|
220
|
+
```
|
221
|
+
|
222
|
+
This gives you details on who's reviewed your pull request. If someone has participated in reviewed,
|
223
|
+
but not given you an approval, this will tell you. `status` prevents you from having to open a browser
|
224
|
+
to find out where your pull request is at. But in case you want to take a look, we give you the option to open it for you.
|
225
|
+
|
226
|
+
### Delivering approved code
|
227
|
+
![git-reflow deliver](http://reenhanced.com/reflow/git-reflow-deliver.gif)
|
228
|
+
```
|
229
|
+
git reflow deliver
|
230
|
+
```
|
231
|
+
|
232
|
+
> **Note:** This documentation is for the process for the github "remote" merge process via the github_api.
|
233
|
+
For the bitbucket standard or github manual process (used when the user applies -f force flag to the "remote" merge via the github_api), please go to section B.
|
234
|
+
|
235
|
+
|
236
|
+
You kick butt. You've got your code reviewed and now you're ready to merge it down to `master` and deploy. Reflow's `deliver` command will take care of all of the steps for you to make this happen.
|
237
|
+
|
238
|
+
Reflow's `deliver` requires you to have a pull request, so you'll be protected on those mornings when the coffee isn't working yet.
|
239
|
+
We built this **to get in your way and make you follow the process**. If you don't like it, do it by hand. You already know what you're doing.
|
240
|
+
|
241
|
+
You'll be presented with a pre-filled commit message based on the body of your pull request with references to the pull request and reviewers.
|
242
|
+
|
243
|
+
Want to clean up your feature branch afterwards? You'll be prompted after you edit your commit message if you want to clean up your **feature-branch** on Github. If you answer `no`, then your **feature-branch** will exist for you to clean it up later.
|
244
|
+
|
245
|
+
This is what it looks like:
|
246
|
+
```
|
247
|
+
$ git reflow deliver
|
248
|
+
Here's the status of your review:
|
249
|
+
branches: simonzhu24:test1234 -> simonzhu24:master
|
250
|
+
number: 51
|
251
|
+
reviewed by: @codenamev
|
252
|
+
url: https://github.com/simonzhu24/test/pull/51
|
253
|
+
|
254
|
+
This is the current status of your Pull Request. Are you sure you want to deliver? yes
|
255
|
+
|
256
|
+
Merging pull request #51: 'last commit message', from 'simonzhu24:test1234' into 'simonzhu24:master'
|
257
|
+
git checkout master
|
258
|
+
Switched to branch 'master'
|
259
|
+
Your branch is ahead of 'origin/master' by 1 commit.
|
260
|
+
(use "git push" to publish your local commits)
|
261
|
+
|
262
|
+
[success] Pull Request successfully merged.
|
263
|
+
Would you like to cleanup your feature branch? yes
|
264
|
+
git pull origin master
|
265
|
+
remote: Counting objects: 1, done.
|
266
|
+
remote: Total 1 (delta 0), reused 0 (delta 0), pack-reused 0
|
267
|
+
Unpacking objects: 100% (1/1), done.
|
268
|
+
From https://github.com/simonzhu24/test
|
269
|
+
* branch master -> FETCH_HEAD
|
270
|
+
0d8f5e0..f853efa master -> origin/master
|
271
|
+
Updating 0b6782f..f853efa
|
272
|
+
Fast-forward
|
273
|
+
README.md | 2 +-
|
274
|
+
1 file changed, 1 insertion(+), 1 deletion(-)
|
275
|
+
|
276
|
+
git push origin :test1234
|
277
|
+
To https://github.com/simonzhu24/test.git
|
278
|
+
- [deleted] test1234
|
279
|
+
|
280
|
+
git branch -D test1234
|
281
|
+
Deleted branch test1234 (was e130c7a).
|
282
|
+
Nice job buddy.
|
283
|
+
```
|
284
|
+
|
285
|
+
#### How it works
|
286
|
+
|
287
|
+
This is what we do behind the scenes when you do `deliver`
|
288
|
+
|
289
|
+
* Does a pull request exist?
|
290
|
+
* If not, stop here. You need to run `review`.
|
291
|
+
* Has the review been completed? Did we get an approval from everyone who's participated?
|
292
|
+
* If not, show a list of authors that need to approve.
|
293
|
+
* If the review is done, it's time to merge. Here's what happens:
|
294
|
+
1. First, we use the github_api gem to merge the pull request ([see here for how we do this](../blob/master/lib/git_reflow_git_server/git_hub/pull_request.rb:102-107)).
|
295
|
+
> **Notice:** we will do a `squash-merge` by default. You can [customize the merge method for your project](https://github.com/reenhanced/gitreflow/wiki/Full-List-of-Configuration-Options).
|
296
|
+
2. Next, we prompt you if you want to cleanup: `Would you like cleanup your feature branch?`
|
297
|
+
* If `yes`, then we'll update the **base-branch** and delete the **feature-branch**
|
298
|
+
```
|
299
|
+
git pull origin <base-branch>
|
300
|
+
git push origin :<feature-branch>
|
301
|
+
git branch -D <feature-branch>
|
302
|
+
```
|
303
|
+
|
304
|
+
* If 'no', then just stop here. The user can clean up his branch locally.
|
305
|
+
|
306
|
+
##### This is what the process looks like for Bitbucket or if you force deliver (`git reflow deliver -f`):
|
307
|
+
```
|
308
|
+
From github.com:reenhanced/gitreflow
|
309
|
+
* branch master -> FETCH_HEAD
|
310
|
+
Merging pull request #36: 'Enforce at least one LGTM before delivery', from 'reenhanced:nh-fail-without-lgtm' into 'reenhanced:master'
|
311
|
+
Already up-to-date.
|
312
|
+
Switched to branch 'nh-fail-without-lgtm'
|
313
|
+
Switched to branch 'master'
|
314
|
+
Updating c2ec1b1..f90e111
|
315
|
+
Squash commit -- not updating HEAD
|
316
|
+
lib/git_reflow.rb | 71 +++++++++++++++++++++++++++----------------------------
|
317
|
+
1 file changed, 35 insertions(+), 36 deletions(-)
|
318
|
+
[master d1b4dd5] Enforces LGTM before deliver, even with no comments.
|
319
|
+
1 file changed, 35 insertions(+), 36 deletions(-)
|
320
|
+
Merge complete!
|
321
|
+
Would you like to push this branch to your remote repo and cleanup your feature branch? y
|
322
|
+
Counting objects: 7, done.
|
323
|
+
Delta compression using up to 16 threads.
|
324
|
+
Compressing objects: 100% (4/4), done.
|
325
|
+
Writing objects: 100% (4/4), 1.38 KiB, done.
|
326
|
+
Total 4 (delta 2), reused 0 (delta 0)
|
327
|
+
To git@github.com:reenhanced/gitreflow.git
|
328
|
+
c2ec1b1..d1b4dd5 master -> master
|
329
|
+
|
330
|
+
To git@github.com:reenhanced/gitreflow.git
|
331
|
+
- [deleted] nh-fail-without-lgtm
|
332
|
+
|
333
|
+
Deleted branch nh-fail-without-lgtm (was f90e111).
|
334
|
+
```
|
335
|
+
This is what the default commit message looks like:
|
336
|
+
```
|
337
|
+
Enforces LGTM before deliver, even with no comments.
|
338
|
+
Removes the need to review the pull request yourself if you make a
|
339
|
+
comment.
|
340
|
+
|
341
|
+
Better error message if setup fails.
|
342
|
+
|
343
|
+
Bug fixes.
|
344
|
+
|
345
|
+
Closes #36
|
346
|
+
|
347
|
+
LGTM given by: @codenamev
|
348
|
+
|
349
|
+
Squashed commit of the following:
|
350
|
+
|
351
|
+
commit f90e111
|
352
|
+
Author: Nicholas Hance <nhance@reenhanced.com>
|
353
|
+
Date: Thu Jul 11 15:33:29 2013 -0400
|
354
|
+
...
|
355
|
+
```
|
356
|
+
|
357
|
+
If the review is done, it's time to merge. Here's what happens:
|
358
|
+
|
359
|
+
1. First, update our local `master` so we don't get conflicts
|
360
|
+
```
|
361
|
+
git checkout master
|
362
|
+
git pull origin master
|
363
|
+
```
|
364
|
+
|
365
|
+
2. Next, merge our feature branch (in our case `squash-merge`)
|
366
|
+
```
|
367
|
+
git merge --squash nh-branch-name
|
368
|
+
```
|
369
|
+
|
370
|
+
3. Now, we'll apply a little magic so we have a great commit message by default.
|
371
|
+
Your editor will open and you'll see a nice default for your commit message based on the pull request body.
|
372
|
+
```
|
373
|
+
git commit
|
374
|
+
```
|
375
|
+
> **Note:** We use `.git/COMMIT_EDITMSG` by default for populating this. See the [Full List of Configuration](https://github.com/reenhanced/gitreflow/wiki/Full-List-of-Configuration-Options) for how you can change this.
|
376
|
+
|
377
|
+
4. Once you've saved the commit, we'll make sure you want to continue.
|
378
|
+
```
|
379
|
+
Merge complete!
|
380
|
+
Would you like to push this branch to your remote repo and cleanup your feature branch?
|
381
|
+
```
|
382
|
+
* If 'yes', then we'll push to **base-branch**(default: `master`) and delete the **feature-branch**
|
383
|
+
```
|
384
|
+
git pull origin master
|
385
|
+
git push origin master
|
386
|
+
git push origin :nh-branch-name
|
387
|
+
git branch -D nh-branch-name
|
388
|
+
```
|
389
|
+
* If 'no', then just stop here. The user can reset his local **base-branch**. And we're done!
|
390
|
+
|
391
|
+
## Guiding Principles
|
392
|
+
* Your workflow should resemble the following:
|
393
|
+
|
394
|
+
![git reflow workflow](http://reenhanced.com/images/reflow.png)
|
395
|
+
|
396
|
+
* You should already know what you're doing.
|
397
|
+
We assume you know how to use git.
|
398
|
+
|
399
|
+
* The `master` branch is your codebase.
|
400
|
+
You don't need multiple branches for code you want to use.
|
401
|
+
|
402
|
+
* `master` should remain stable at all times.
|
403
|
+
The entire team depends on it.
|
404
|
+
|
405
|
+
* No direct commits to `master`.
|
406
|
+
All work happens in feature branches. From a single commit to hundreds.
|
407
|
+
|
408
|
+
* All feature branches are reviewed via pull requests.
|
409
|
+
|
410
|
+
* Looks Good To Me. All feature branches require approval.
|
411
|
+
We check both Github's Approvals, and look for the string 'LGTM' in a comment on the pull request to know it's ready to merge.
|
412
|
+
|
413
|
+
* If you make a new commit in your branch, you require another review.
|
414
|
+
|
415
|
+
* Depending on your `git config constants.minimumApprovals` setting, which we specify in your ~/.gitconfig.reflow (created upon reflow setup), you can have the following:
|
416
|
+
|
417
|
+
| minimumApprovals | Applied Restrictions |
|
418
|
+
|:----------------:| ------------------------------------------------------------------------------|
|
419
|
+
| "" | All participants in a pull request must approve the pull request. |
|
420
|
+
| "0" | 0 approvals required for you to merge PR. |
|
421
|
+
| "1" | You need a minimum of 1 LGTM and the last comment on your PR must be an LGTM. |
|
422
|
+
| "2" | You need a minimum of 2 LGTM and the last comment on your PR must be an LGTM. |
|
423
|
+
|
424
|
+
* Once approved, your **feature-branch** is merged to your **base-branch**.
|
425
|
+
This makes the history of the **base-branch** extremely clean and easy to follow.
|
426
|
+
|
427
|
+
* `git blame` becomes your friend. You'll know who to blame and can see the full context of changes.
|
428
|
+
Squash commits to **base-branch** mean every commit represents the whole feature, not a "typo fix".
|
429
|
+
|
430
|
+
|
431
|
+
## Configuration
|
432
|
+
|
433
|
+
In order to streamline delivery you can set the following git config to:
|
434
|
+
|
435
|
+
1. always clean up the feature branch after the PR is merged
|
436
|
+
```
|
437
|
+
git config --global --add "reflow.always-cleanup" "true"
|
438
|
+
```
|
439
|
+
2. always deliver without further prompt
|
440
|
+
```
|
441
|
+
git config --global --add "reflow.always-deliver" "true"
|
442
|
+
```
|
443
|
+
|
444
|
+
See our [Advanced Usage](https://github.com/reenhanced/gitreflow/wiki/Full-List-of-Configuration-Options) for more ways you can customize your workflow.
|
445
|
+
|
446
|
+
---
|
447
|
+
|
448
|
+
## Contributing
|
449
|
+
Pull requests are welcome. Please fork and submit. We use this tool every single day and as long as what you want to add doesn't change our workflow, we are happy to accept your updates. Feel free to add your Github username to the list below.
|
450
|
+
|
451
|
+
Authors:
|
452
|
+
* @codenamev
|
453
|
+
* @armyofgnomes
|
454
|
+
* @nhance
|
455
|
+
|
456
|
+
Built by Reenhanced:
|
457
|
+
http://www.reenhanced.com
|
458
|
+
|
459
|
+
**Looking for a capable team for your project? Get in touch. We're looking to grow.**
|
460
|
+
|
461
|
+
_Licensed using the MIT license. Do whatever you like with this, but don't blame us if it breaks anything. You're a professional, and you're responsible for the tools you use._
|