git_reflow 0.8.9 → 0.9.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (87) hide show
  1. checksums.yaml +5 -5
  2. data/.github/workflows/multi-ruby-tests.yml +33 -0
  3. data/.gitignore +1 -0
  4. data/.rubocop.yml +2 -0
  5. data/.ruby-version +1 -0
  6. data/Appraisals +1 -6
  7. data/CHANGELOG.md +466 -348
  8. data/Gemfile.lock +99 -72
  9. data/LICENSE +20 -20
  10. data/README.md +481 -0
  11. data/Rakefile +15 -8
  12. data/Workflow +3 -0
  13. data/_config.yml +1 -0
  14. data/bin/console +7 -7
  15. data/bin/setup +6 -6
  16. data/exe/git-reflow +20 -36
  17. data/git_reflow.gemspec +26 -30
  18. data/lib/git_reflow.rb +3 -15
  19. data/lib/git_reflow/config.rb +48 -13
  20. data/lib/git_reflow/git_helpers.rb +69 -22
  21. data/lib/git_reflow/git_server.rb +63 -63
  22. data/lib/git_reflow/git_server/base.rb +68 -68
  23. data/lib/git_reflow/git_server/bit_bucket.rb +101 -101
  24. data/lib/git_reflow/git_server/bit_bucket/pull_request.rb +84 -84
  25. data/lib/git_reflow/git_server/git_hub.rb +53 -41
  26. data/lib/git_reflow/git_server/git_hub/pull_request.rb +16 -14
  27. data/lib/git_reflow/git_server/pull_request.rb +4 -2
  28. data/lib/git_reflow/merge_error.rb +9 -9
  29. data/lib/git_reflow/rspec.rb +3 -2
  30. data/lib/git_reflow/rspec/command_line_helpers.rb +23 -6
  31. data/lib/git_reflow/rspec/stub_helpers.rb +13 -13
  32. data/lib/git_reflow/rspec/workflow_helpers.rb +18 -0
  33. data/lib/git_reflow/sandbox.rb +16 -6
  34. data/lib/git_reflow/version.rb +1 -1
  35. data/lib/git_reflow/workflow.rb +304 -9
  36. data/lib/git_reflow/workflows/FlatMergeWorkflow +38 -0
  37. data/lib/git_reflow/workflows/core.rb +364 -238
  38. data/spec/fixtures/authentication_failure.json +3 -0
  39. data/spec/fixtures/awesome_workflow.rb +3 -7
  40. data/spec/fixtures/git/git_config +7 -7
  41. data/spec/fixtures/issues/comment.json.erb +27 -27
  42. data/spec/fixtures/issues/comments.json +29 -29
  43. data/spec/fixtures/issues/comments.json.erb +15 -15
  44. data/spec/fixtures/pull_requests/comment.json.erb +45 -45
  45. data/spec/fixtures/pull_requests/comments.json +47 -47
  46. data/spec/fixtures/pull_requests/comments.json.erb +15 -15
  47. data/spec/fixtures/pull_requests/commits.json +29 -29
  48. data/spec/fixtures/pull_requests/external_pull_request.json +145 -145
  49. data/spec/fixtures/pull_requests/pull_request.json +142 -142
  50. data/spec/fixtures/pull_requests/pull_request.json.erb +142 -142
  51. data/spec/fixtures/pull_requests/pull_request_branch_nonexistent_error.json +32 -0
  52. data/spec/fixtures/pull_requests/pull_request_exists_error.json +32 -32
  53. data/spec/fixtures/pull_requests/pull_requests.json +136 -136
  54. data/spec/fixtures/repositories/commit.json +53 -53
  55. data/spec/fixtures/repositories/commit.json.erb +53 -53
  56. data/spec/fixtures/repositories/commits.json.erb +13 -13
  57. data/spec/fixtures/repositories/statuses.json +31 -31
  58. data/spec/fixtures/users/user.json +32 -0
  59. data/spec/lib/git_reflow/git_helpers_spec.rb +115 -12
  60. data/spec/lib/git_reflow/git_server/bit_bucket_spec.rb +81 -81
  61. data/spec/lib/git_reflow/git_server/git_hub/pull_request_spec.rb +10 -10
  62. data/spec/lib/git_reflow/git_server/git_hub_spec.rb +77 -3
  63. data/spec/lib/git_reflow/git_server/pull_request_spec.rb +9 -3
  64. data/spec/lib/git_reflow/git_server_spec.rb +101 -101
  65. data/spec/lib/git_reflow/sandbox_spec.rb +1 -1
  66. data/spec/lib/git_reflow/workflow_spec.rb +304 -59
  67. data/spec/lib/git_reflow/workflows/core_spec.rb +225 -67
  68. data/spec/lib/git_reflow/workflows/flat_merge_spec.rb +71 -59
  69. data/spec/lib/git_reflow_spec.rb +2 -25
  70. data/spec/spec_helper.rb +3 -0
  71. data/spec/support/fixtures.rb +54 -54
  72. data/spec/support/github_helpers.rb +99 -109
  73. data/spec/support/mock_pull_request.rb +17 -17
  74. data/spec/support/web_mocks.rb +39 -39
  75. metadata +51 -74
  76. data/README.rdoc +0 -461
  77. data/circle.yml +0 -26
  78. data/lib/git_reflow/commands/deliver.rb +0 -10
  79. data/lib/git_reflow/commands/refresh.rb +0 -20
  80. data/lib/git_reflow/commands/review.rb +0 -13
  81. data/lib/git_reflow/commands/setup.rb +0 -11
  82. data/lib/git_reflow/commands/stage.rb +0 -9
  83. data/lib/git_reflow/commands/start.rb +0 -18
  84. data/lib/git_reflow/commands/status.rb +0 -7
  85. data/lib/git_reflow/os_detector.rb +0 -23
  86. data/lib/git_reflow/workflows/flat_merge.rb +0 -10
  87. data/spec/fixtures/workflow_with_super.rb +0 -8
@@ -1,118 +1,145 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- git_reflow (0.8.9)
4
+ git_reflow (0.9.3)
5
+ bundler (>= 1.10.0)
6
+ codenamev_bitbucket_api (= 0.4.1)
5
7
  colorize (>= 0.7.0)
6
- github_api (= 0.15.0)
7
- gli (= 2.15.0)
8
+ github_api (= 0.18.2)
8
9
  highline
9
10
  httpclient
10
- rack (>= 1.2, < 2)
11
- reenhanced_bitbucket_api (= 0.3.2)
12
11
 
13
12
  GEM
14
13
  remote: https://rubygems.org/
15
14
  specs:
16
- addressable (2.4.0)
17
- appraisal (2.1.0)
15
+ activesupport (6.0.3.1)
16
+ concurrent-ruby (~> 1.0, >= 1.0.2)
17
+ i18n (>= 0.7, < 2)
18
+ minitest (~> 5.1)
19
+ tzinfo (~> 1.1)
20
+ zeitwerk (~> 2.2, >= 2.2.2)
21
+ addressable (2.7.0)
22
+ public_suffix (>= 2.0.2, < 5.0)
23
+ appraisal (2.2.0)
18
24
  bundler
19
25
  rake
20
26
  thor (>= 0.14.0)
21
- byebug (9.0.6)
27
+ byebug (11.1.3)
22
28
  chronic (0.10.2)
23
- coderay (1.1.1)
29
+ codenamev_bitbucket_api (0.4.1)
30
+ faraday (< 2.0)
31
+ faraday_middleware (< 2.0)
32
+ hashie
33
+ multi_json (< 2.0)
34
+ nokogiri (>= 1.5.2)
35
+ simple_oauth (>= 0.3.0)
36
+ coderay (1.1.2)
24
37
  colorize (0.8.1)
38
+ concurrent-ruby (1.1.6)
25
39
  crack (0.4.3)
26
40
  safe_yaml (~> 1.0.0)
27
41
  descendants_tracker (0.0.4)
28
42
  thread_safe (~> 0.3, >= 0.3.1)
29
43
  diff-lcs (1.3)
30
- faraday (0.9.2)
44
+ faraday (0.17.3)
31
45
  multipart-post (>= 1.2, < 3)
32
- faraday_middleware (0.9.2)
33
- faraday (>= 0.7.4, < 0.10)
34
- github_api (0.15.0)
35
- addressable (~> 2.4.0)
46
+ faraday-http-cache (2.2.0)
47
+ faraday (>= 0.8)
48
+ faraday_middleware (0.14.0)
49
+ faraday (>= 0.7.4, < 1.0)
50
+ github_api (0.18.2)
51
+ addressable (~> 2.4)
36
52
  descendants_tracker (~> 0.0.4)
37
- faraday (~> 0.8, < 0.10)
38
- hashie (>= 3.4)
39
- mime-types (>= 1.16, < 3.0)
53
+ faraday (~> 0.8)
54
+ hashie (~> 3.5, >= 3.5.2)
40
55
  oauth2 (~> 1.0)
41
- gli (2.15.0)
42
- hashdiff (0.3.2)
43
- hashie (3.5.5)
44
- highline (1.7.8)
56
+ github_changelog_generator (1.15.2)
57
+ activesupport
58
+ faraday-http-cache
59
+ multi_json
60
+ octokit (~> 4.6)
61
+ rainbow (>= 2.2.1)
62
+ rake (>= 10.0)
63
+ retriable (~> 3.0)
64
+ hashdiff (1.0.1)
65
+ hashie (3.6.0)
66
+ highline (2.0.3)
45
67
  httpclient (2.8.3)
46
- jwt (1.5.6)
47
- method_source (0.8.2)
48
- mime-types (2.99.3)
49
- mini_portile2 (2.1.0)
50
- multi_json (1.12.1)
68
+ i18n (1.8.2)
69
+ concurrent-ruby (~> 1.0)
70
+ jwt (2.2.1)
71
+ method_source (1.0.0)
72
+ mini_portile2 (2.4.0)
73
+ minitest (5.14.1)
74
+ multi_json (1.14.1)
51
75
  multi_xml (0.6.0)
52
- multipart-post (2.0.0)
53
- nokogiri (1.7.1)
54
- mini_portile2 (~> 2.1.0)
55
- oauth2 (1.3.1)
56
- faraday (>= 0.8, < 0.12)
57
- jwt (~> 1.0)
76
+ multipart-post (2.1.1)
77
+ nokogiri (1.10.9)
78
+ mini_portile2 (~> 2.4.0)
79
+ oauth2 (1.4.4)
80
+ faraday (>= 0.8, < 2.0)
81
+ jwt (>= 1.0, < 3.0)
58
82
  multi_json (~> 1.3)
59
83
  multi_xml (~> 0.5)
60
84
  rack (>= 1.2, < 3)
61
- pry (0.10.4)
62
- coderay (~> 1.1.0)
63
- method_source (~> 0.8.1)
64
- slop (~> 3.4)
65
- pry-byebug (3.4.2)
66
- byebug (~> 9.0)
67
- pry (~> 0.10)
68
- rack (1.6.5)
69
- rake (11.3.0)
70
- rdoc (5.1.0)
71
- reenhanced_bitbucket_api (0.3.2)
72
- faraday (~> 0.9.0)
73
- faraday_middleware (~> 0.9.0)
74
- hashie (>= 3.2)
75
- multi_json (>= 1.7.5, < 2.0)
76
- nokogiri (>= 1.5.2)
77
- simple_oauth (>= 0.3.0)
78
- rspec (3.4.0)
79
- rspec-core (~> 3.4.0)
80
- rspec-expectations (~> 3.4.0)
81
- rspec-mocks (~> 3.4.0)
82
- rspec-core (3.4.4)
83
- rspec-support (~> 3.4.0)
84
- rspec-expectations (3.4.0)
85
+ octokit (4.18.0)
86
+ faraday (>= 0.9)
87
+ sawyer (~> 0.8.0, >= 0.5.3)
88
+ pry (0.13.1)
89
+ coderay (~> 1.1)
90
+ method_source (~> 1.0)
91
+ pry-byebug (3.9.0)
92
+ byebug (~> 11.0)
93
+ pry (~> 0.13.0)
94
+ public_suffix (4.0.5)
95
+ rack (2.2.2)
96
+ rainbow (3.0.0)
97
+ rake (13.0.1)
98
+ rdoc (6.2.1)
99
+ retriable (3.1.2)
100
+ rspec (3.9.0)
101
+ rspec-core (~> 3.9.0)
102
+ rspec-expectations (~> 3.9.0)
103
+ rspec-mocks (~> 3.9.0)
104
+ rspec-core (3.9.2)
105
+ rspec-support (~> 3.9.3)
106
+ rspec-expectations (3.9.2)
85
107
  diff-lcs (>= 1.2.0, < 2.0)
86
- rspec-support (~> 3.4.0)
87
- rspec-mocks (3.4.1)
108
+ rspec-support (~> 3.9.0)
109
+ rspec-mocks (3.9.1)
88
110
  diff-lcs (>= 1.2.0, < 2.0)
89
- rspec-support (~> 3.4.0)
90
- rspec-support (3.4.1)
91
- safe_yaml (1.0.4)
111
+ rspec-support (~> 3.9.0)
112
+ rspec-support (3.9.3)
113
+ safe_yaml (1.0.5)
114
+ sawyer (0.8.2)
115
+ addressable (>= 2.3.5)
116
+ faraday (> 0.8, < 2.0)
92
117
  simple_oauth (0.3.1)
93
- slop (3.6.0)
94
- thor (0.19.4)
118
+ thor (1.0.1)
95
119
  thread_safe (0.3.6)
96
- webmock (2.3.2)
120
+ tzinfo (1.2.7)
121
+ thread_safe (~> 0.1)
122
+ webmock (3.8.3)
97
123
  addressable (>= 2.3.6)
98
124
  crack (>= 0.3.2)
99
- hashdiff
100
- wwtd (1.3.0)
125
+ hashdiff (>= 0.4.0, < 2.0.0)
126
+ wwtd (1.4.0)
127
+ zeitwerk (2.3.0)
101
128
 
102
129
  PLATFORMS
103
130
  ruby
104
131
 
105
132
  DEPENDENCIES
106
- appraisal (= 2.1.0)
107
- bundler (~> 1.12)
133
+ appraisal (= 2.2.0)
108
134
  chronic
109
135
  git_reflow!
136
+ github_changelog_generator
110
137
  pry-byebug
111
- rake (~> 11.0)
138
+ rake (~> 13.0.1)
112
139
  rdoc
113
- rspec (~> 3.4.0)
140
+ rspec (~> 3.9)
114
141
  webmock
115
- wwtd (= 1.3.0)
142
+ wwtd (= 1.4)
116
143
 
117
144
  BUNDLED WITH
118
- 1.14.6
145
+ 2.1.4
data/LICENSE CHANGED
@@ -1,20 +1,20 @@
1
- The MIT License (MIT)
2
-
3
- Copyright (c) 2014 Reenhanced L.L.C.
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy of
6
- this software and associated documentation files (the "Software"), to deal in
7
- the Software without restriction, including without limitation the rights to
8
- use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9
- the Software, and to permit persons to whom the Software is furnished to do so,
10
- subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17
- FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18
- COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19
- IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20
- CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2014 Reenhanced L.L.C.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
6
+ this software and associated documentation files (the "Software"), to deal in
7
+ the Software without restriction, including without limitation the rights to
8
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9
+ the Software, and to permit persons to whom the Software is furnished to do so,
10
+ subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17
+ FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18
+ COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19
+ IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20
+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,481 @@
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://actions-badge.atrox.dev/reenhanced/gitreflow/goto?ref=master" title="git workflow">
8
+ <img alt="Git workflow powered by git-reflow" src="https://img.shields.io/endpoint.svg?url=https%3A%2F%2Factions-badge.atrox.dev%2Freenhanced%2Fgitreflow%2Fbadge%3Fref%3Dmaster&style=flat">
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.9.0-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 will look up the `reflow.base-branch` git configuration or default 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
+ > **Note:** If no `base-branch` argument is provided, then we'll look for a `reflow.base-branch` git
141
+ > configuration and fallback to `master` as the default.
142
+
143
+ ### Reviewing your work
144
+ ![git reflow review](http://reenhanced.com/reflow/git-reflow-review.gif)
145
+ ```
146
+ git reflow review
147
+ ```
148
+
149
+ All of our work is reviewed by our team. This helps spread knowledge to multiple parties and keeps the quality of our code consistent.
150
+
151
+ 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.
152
+ We assume you know what you're doing, so if you need something different, do it by hand.
153
+
154
+ After making commits to your branch, run `review`. Didn't push it up? No problem, we'll do it for you.
155
+ ```
156
+ git reflow review -t <title> -m <message> <base-branch>
157
+ ```
158
+ > **Note:** `-t` and `-m` are optional, as is the `base-branch` argument. If no
159
+ > base-branch is provided, then we'll look for a `reflow.base-branch` git
160
+ > configuration and fallback to `master` as the default.
161
+
162
+ 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.
163
+
164
+ ```
165
+ $ git reflow review
166
+
167
+ Review your PR:
168
+ --------
169
+ Title:
170
+ rj_209_test
171
+
172
+ Body:
173
+ [lib] updates review command to address issues
174
+ --------
175
+ Submit pull request? (Y): <enter>
176
+ git fetch origin master
177
+ From github.com:meesterdude/gitreflow
178
+ * branch master -> FETCH_HEAD
179
+
180
+ git push origin rj_test
181
+ Everything up-to-date
182
+
183
+ Successfully created pull request #6: rj_test
184
+ Pull Request URL: https://github.com/meesterdude/gitreflow/pull/6
185
+ Would you like to push this branch to your remote repo and cleanup your feature branch? y<enter>
186
+ ```
187
+
188
+ We output the pull request URL so you can distribute it to your team.
189
+
190
+ #### How it works
191
+ Behind the scenes, this is how `review` works:
192
+ ```
193
+ git fetch origin
194
+ ```
195
+
196
+ Are we up-to-date with changes from master?
197
+ If not, fail with "master has newer changes".
198
+
199
+ Then,
200
+ ```
201
+ git push origin current-branch # Updates remote branch
202
+ ```
203
+
204
+ Do we have pull request?
205
+ If not, create it and print "Pull request created at http://pull-url/". If so, print the url for the existing request.
206
+
207
+ ### Checking your branch status
208
+ ![git reflow status](http://reenhanced.com/reflow/git-reflow-status.gif)
209
+ ```
210
+ git reflow status <base-branch>
211
+ ```
212
+
213
+ > **Note:** If no `base-branch` is provided, then we'll look for a `reflow.base-branch` git
214
+ > configuration and fallback to `master` as the default.
215
+
216
+ 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.
217
+
218
+ ```
219
+ $ git reflow status
220
+
221
+ Here's the status of your review:
222
+ branches: reenhanced:nh-readme-update -> reenhanced:master
223
+ number: 35
224
+ reviewed by:
225
+ url: https://github.com/reenhanced/gitreflow/pull/35
226
+
227
+ [notice] No one has reviewed your pull request.
228
+ ```
229
+
230
+ This gives you details on who's reviewed your pull request. If someone has participated in reviewed,
231
+ but not given you an approval, this will tell you. `status` prevents you from having to open a browser
232
+ 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.
233
+
234
+ ### Delivering approved code
235
+ ![git-reflow deliver](http://reenhanced.com/reflow/git-reflow-deliver.gif)
236
+ ```
237
+ git reflow deliver <base-branch>
238
+ ```
239
+
240
+ > **Note:** If no `base-branch` argument is provided, then we'll look for a `reflow.base-branch` git
241
+ > configuration and fallback to `master` as the default.
242
+
243
+ > **Also:** This documentation is for the process for the github "remote" merge process via the github_api.
244
+ 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.
245
+
246
+
247
+ 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.
248
+
249
+ 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.
250
+ 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.
251
+
252
+ 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.
253
+
254
+ 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.
255
+
256
+ This is what it looks like:
257
+ ```
258
+ $ git reflow deliver
259
+ Here's the status of your review:
260
+ branches: simonzhu24:test1234 -> simonzhu24:master
261
+ number: 51
262
+ reviewed by: @codenamev
263
+ url: https://github.com/simonzhu24/test/pull/51
264
+
265
+ This is the current status of your Pull Request. Are you sure you want to deliver? yes
266
+
267
+ Merging pull request #51: 'last commit message', from 'simonzhu24:test1234' into 'simonzhu24:master'
268
+ git checkout master
269
+ Switched to branch 'master'
270
+ Your branch is ahead of 'origin/master' by 1 commit.
271
+ (use "git push" to publish your local commits)
272
+
273
+ [success] Pull Request successfully merged.
274
+ Would you like to cleanup your feature branch? yes
275
+ git pull origin master
276
+ remote: Counting objects: 1, done.
277
+ remote: Total 1 (delta 0), reused 0 (delta 0), pack-reused 0
278
+ Unpacking objects: 100% (1/1), done.
279
+ From https://github.com/simonzhu24/test
280
+ * branch master -> FETCH_HEAD
281
+ 0d8f5e0..f853efa master -> origin/master
282
+ Updating 0b6782f..f853efa
283
+ Fast-forward
284
+ README.md | 2 +-
285
+ 1 file changed, 1 insertion(+), 1 deletion(-)
286
+
287
+ git push origin :test1234
288
+ To https://github.com/simonzhu24/test.git
289
+ - [deleted] test1234
290
+
291
+ git branch -D test1234
292
+ Deleted branch test1234 (was e130c7a).
293
+ Nice job buddy.
294
+ ```
295
+
296
+ #### How it works
297
+
298
+ This is what we do behind the scenes when you do `deliver`
299
+
300
+ * Does a pull request exist?
301
+ * If not, stop here. You need to run `review`.
302
+ * Has the review been completed? Did we get an approval from everyone who's participated?
303
+ * If not, show a list of authors that need to approve.
304
+ * If the review is done, it's time to merge. Here's what happens:
305
+ 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)).
306
+ > **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).
307
+ 2. Next, we prompt you if you want to cleanup: `Would you like cleanup your feature branch?`
308
+ * If `yes`, then we'll update the **base-branch** and delete the **feature-branch**
309
+ ```
310
+ git pull origin <base-branch>
311
+ git push origin :<feature-branch>
312
+ git branch -D <feature-branch>
313
+ ```
314
+
315
+ * If 'no', then just stop here. The user can clean up his branch locally.
316
+
317
+ ##### This is what the process looks like for Bitbucket or if you force deliver (`git reflow deliver -f`):
318
+ ```
319
+ From github.com:reenhanced/gitreflow
320
+ * branch master -> FETCH_HEAD
321
+ Merging pull request #36: 'Enforce at least one LGTM before delivery', from 'reenhanced:nh-fail-without-lgtm' into 'reenhanced:master'
322
+ Already up-to-date.
323
+ Switched to branch 'nh-fail-without-lgtm'
324
+ Switched to branch 'master'
325
+ Updating c2ec1b1..f90e111
326
+ Squash commit -- not updating HEAD
327
+ lib/git_reflow.rb | 71 +++++++++++++++++++++++++++----------------------------
328
+ 1 file changed, 35 insertions(+), 36 deletions(-)
329
+ [master d1b4dd5] Enforces LGTM before deliver, even with no comments.
330
+ 1 file changed, 35 insertions(+), 36 deletions(-)
331
+ Merge complete!
332
+ Would you like to push this branch to your remote repo and cleanup your feature branch? y
333
+ Counting objects: 7, done.
334
+ Delta compression using up to 16 threads.
335
+ Compressing objects: 100% (4/4), done.
336
+ Writing objects: 100% (4/4), 1.38 KiB, done.
337
+ Total 4 (delta 2), reused 0 (delta 0)
338
+ To git@github.com:reenhanced/gitreflow.git
339
+ c2ec1b1..d1b4dd5 master -> master
340
+
341
+ To git@github.com:reenhanced/gitreflow.git
342
+ - [deleted] nh-fail-without-lgtm
343
+
344
+ Deleted branch nh-fail-without-lgtm (was f90e111).
345
+ ```
346
+ This is what the default commit message looks like:
347
+ ```
348
+ Enforces LGTM before deliver, even with no comments.
349
+ Removes the need to review the pull request yourself if you make a
350
+ comment.
351
+
352
+ Better error message if setup fails.
353
+
354
+ Bug fixes.
355
+
356
+ Closes #36
357
+
358
+ LGTM given by: @codenamev
359
+
360
+ Squashed commit of the following:
361
+
362
+ commit f90e111
363
+ Author: Nicholas Hance <nhance@reenhanced.com>
364
+ Date: Thu Jul 11 15:33:29 2013 -0400
365
+ ...
366
+ ```
367
+
368
+ If the review is done, it's time to merge. Here's what happens:
369
+
370
+ 1. First, update our local `master` so we don't get conflicts
371
+ ```
372
+ git checkout master
373
+ git pull origin master
374
+ ```
375
+
376
+ 2. Next, merge our feature branch (in our case `squash-merge`)
377
+ ```
378
+ git merge --squash nh-branch-name
379
+ ```
380
+
381
+ 3. Now, we'll apply a little magic so we have a great commit message by default.
382
+ Your editor will open and you'll see a nice default for your commit message based on the pull request body.
383
+ ```
384
+ git commit
385
+ ```
386
+ > **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.
387
+
388
+ 4. Once you've saved the commit, we'll make sure you want to continue.
389
+ ```
390
+ Merge complete!
391
+ Would you like to push this branch to your remote repo and cleanup your feature branch?
392
+ ```
393
+ * If 'yes', then we'll push to **base-branch**(default: `master`) and delete the **feature-branch**
394
+ ```
395
+ git pull origin master
396
+ git push origin master
397
+ git push origin :nh-branch-name
398
+ git branch -D nh-branch-name
399
+ ```
400
+ * If 'no', then just stop here. The user can reset his local **base-branch**. And we're done!
401
+
402
+ ## Guiding Principles
403
+ * Your workflow should resemble the following:
404
+
405
+ ![git reflow workflow](http://reenhanced.com/images/reflow.png)
406
+
407
+ * You should already know what you're doing.
408
+ We assume you know how to use git.
409
+
410
+ * The `master` branch is your codebase.
411
+ You don't need multiple branches for code you want to use.
412
+
413
+ * `master` should remain stable at all times.
414
+ The entire team depends on it.
415
+
416
+ * No direct commits to `master`.
417
+ All work happens in feature branches. From a single commit to hundreds.
418
+
419
+ * All feature branches are reviewed via pull requests.
420
+
421
+ * Looks Good To Me. All feature branches require approval.
422
+ 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.
423
+
424
+ * If you make a new commit in your branch, you require another review.
425
+
426
+ * Depending on your `git config constants.minimumApprovals` setting, which we specify in your ~/.gitconfig.reflow (created upon reflow setup), you can have the following:
427
+
428
+ | minimumApprovals | Applied Restrictions |
429
+ |:----------------:| ------------------------------------------------------------------------------|
430
+ | "" | All participants in a pull request must approve the pull request. |
431
+ | "0" | 0 approvals required for you to merge PR. |
432
+ | "1" | You need a minimum of 1 LGTM and the last comment on your PR must be an LGTM. |
433
+ | "2" | You need a minimum of 2 LGTM and the last comment on your PR must be an LGTM. |
434
+
435
+ * Once approved, your **feature-branch** is merged to your **base-branch**.
436
+ This makes the history of the **base-branch** extremely clean and easy to follow.
437
+
438
+ * `git blame` becomes your friend. You'll know who to blame and can see the full context of changes.
439
+ Squash commits to **base-branch** mean every commit represents the whole feature, not a "typo fix".
440
+
441
+
442
+ ## Configuration
443
+
444
+ In order to streamline delivery you can set the following git config to:
445
+
446
+ 1. always clean up the feature branch after the PR is merged
447
+ ```
448
+ git config --global --add "reflow.always-cleanup" "true"
449
+ ```
450
+ 2. always deliver without further prompt
451
+ ```
452
+ git config --global --add "reflow.always-deliver" "true"
453
+ ```
454
+
455
+ See our [Advanced Usage](https://github.com/reenhanced/gitreflow/wiki/Full-List-of-Configuration-Options) for more ways you can customize your workflow.
456
+
457
+ ## Customization
458
+
459
+ Git-reflow's default process isn't meant to fit every team, which is why we've introduced [Custom Workflows](https://github.com/reenhanced/gitreflow/wiki/Custom-Workflows). With a custom workflow, you can:
460
+
461
+ * Add hooks to be run before, or after any command
462
+ * Use one of our pre-configured workflows as a basis for your own
463
+ * Override any of the default commands
464
+ * Create new commands
465
+
466
+ ---
467
+
468
+ ## Contributing
469
+ 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.
470
+
471
+ Authors:
472
+ * @codenamev
473
+ * @armyofgnomes
474
+ * @nhance
475
+
476
+ Built by Reenhanced:
477
+ http://www.reenhanced.com
478
+
479
+ **Looking for a capable team for your project? Get in touch. We're looking to grow.**
480
+
481
+ _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._