git-process-lib 2.0.4 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/CHANGELOG.md +16 -1
- data/Gemfile +15 -15
- data/Gemfile.lock +59 -44
- data/LICENSE +1 -1
- data/{README.md → README.adoc} +101 -93
- data/git-new-fb.gemspec +7 -7
- data/git-process-lib.gemspec +12 -15
- data/git-process.gemspec +10 -10
- data/git-pull-req.gemspec +7 -7
- data/git-sync.gemspec +7 -7
- data/git-to-master.gemspec +7 -7
- data/lib/git-process/git_branch.rb +41 -2
- data/lib/git-process/git_branches.rb +1 -1
- data/lib/git-process/git_config.rb +16 -6
- data/lib/git-process/git_lib.rb +305 -92
- data/lib/git-process/git_logger.rb +17 -22
- data/lib/git-process/git_process.rb +13 -6
- data/lib/git-process/git_remote.rb +34 -6
- data/lib/git-process/github_configuration.rb +156 -47
- data/lib/git-process/github_pull_request.rb +64 -10
- data/lib/git-process/pull_request.rb +5 -5
- data/lib/git-process/version.rb +2 -2
- data/local-build.rb +6 -2
- data/spec/changed_file_helper_spec.rb +1 -1
- data/spec/git_branch_spec.rb +35 -0
- data/spec/git_lib_spec.rb +32 -9
- data/spec/git_process_spec.rb +34 -26
- data/spec/git_remote_spec.rb +2 -2
- data/spec/github_configuration_spec.rb +67 -16
- data/spec/github_pull_request_spec.rb +18 -17
- data/spec/github_test_helper.rb +59 -5
- data/spec/new_fb_spec.rb +14 -14
- data/spec/pull_request_helper.rb +2 -2
- data/spec/pull_request_spec.rb +13 -11
- data/spec/rebase_to_master_spec.rb +10 -10
- data/spec/sync_spec.rb +20 -3
- metadata +114 -155
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: c814fd9a301f2ab6362a357479c92690a65b4501
|
4
|
+
data.tar.gz: 503cbe342c78a16654e9f29b37a29500e885530f
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 02e94090e1bd1a620e4d6dd670c02fa166b04146644fe1ff197c9f2f0b05eb9dab03f0a6ccc6506b7892f337a227b3f6867dae7f118c9de6a7e7841fae76b546
|
7
|
+
data.tar.gz: 779f8617a4eb111c4f9a0acac64ed4c5b2c321cedc58e46a36dca8811bf7d0dd951a3dfa33f06aae75ca3377b5bca205acf931e1ddfebde265428bc6ba937032
|
data/CHANGELOG.md
CHANGED
@@ -1,4 +1,19 @@
|
|
1
|
-
# CHANGELOG -
|
1
|
+
# CHANGELOG - 3.0.0 #
|
2
|
+
|
3
|
+
### Since 2.0.5 ###
|
4
|
+
|
5
|
+
* Updated Ruby support to 2.x ([GH-140](https://github.com/jdigger/git-process/issues/140))
|
6
|
+
* Fixed a number of comparability issues with Ruby 2.x, such as [GH-139](https://github.com/jdigger/git-process/issues/139) and [GH-132](https://github.com/jdigger/git-process/issues/132)
|
7
|
+
* Ruby < 2.0 is no longer supported
|
8
|
+
* Updated Gem libraries to latest versions (2016-03-18)
|
9
|
+
* Most notably, upgraded to Octokit 4.3 for support of the latest GitHub APIs
|
10
|
+
* Implemented support for GitHub two-factor authentication ([GH-141](https://github.com/jdigger/git-process/issues/141))
|
11
|
+
* Added Faraday logging to help debug issues when communicating with GitHub
|
12
|
+
|
13
|
+
### Since 2.0.4 ###
|
14
|
+
|
15
|
+
* Updated to replace '/' with '-' when generating the sync control filename. ([GH-130](https://github.com/jdigger/git-process/issues/130))
|
16
|
+
* Deprecated support for Ruby 1.8. (Should continue to work, but now that OS X has moved to Ruby 2.0 there's no longer much reason to support such an old version and it was making tests break.)
|
2
17
|
|
3
18
|
### Since 2.0.3 ###
|
4
19
|
|
data/Gemfile
CHANGED
@@ -1,24 +1,24 @@
|
|
1
|
-
source
|
1
|
+
source 'http://rubygems.org'
|
2
2
|
|
3
3
|
group :default do
|
4
|
-
gem
|
5
|
-
gem
|
6
|
-
gem
|
7
|
-
gem
|
8
|
-
gem
|
9
|
-
|
10
|
-
# lock down external dependency
|
11
|
-
gem "faraday", "0.8.9"
|
4
|
+
gem 'octokit', '~> 4.3' # GitHub API
|
5
|
+
gem 'netrc', '~> 0.11'
|
6
|
+
gem 'json', '~> 1.8'
|
7
|
+
gem 'trollop', '~> 2.1' # CLI options parser
|
8
|
+
gem 'highline', '~> 1.7' # user CLI interaction
|
9
|
+
gem 'addressable', '~> 2.3.5' # URI processing. 2.4 Changes URI parsing
|
12
10
|
end
|
13
11
|
|
14
12
|
group :development do
|
15
|
-
gem
|
16
|
-
gem
|
17
|
-
gem
|
13
|
+
gem 'rake'#, '~> 0.9'
|
14
|
+
gem 'yard'#, '~> 0.8' # documentation generator
|
15
|
+
gem 'redcarpet'#, '~> 2'
|
18
16
|
end
|
19
17
|
|
20
18
|
group :test do
|
21
|
-
gem
|
22
|
-
gem
|
23
|
-
gem
|
19
|
+
gem 'rspec', '~> 2.99'
|
20
|
+
gem 'webmock', '~> 1.24' # network mocking
|
21
|
+
gem 'vcr'
|
22
|
+
gem 'rugged', '~> 0.18.0.gh.de28323'
|
23
|
+
gem 'climate_control', '~> 0.0.3'
|
24
24
|
end
|
data/Gemfile.lock
CHANGED
@@ -1,58 +1,73 @@
|
|
1
1
|
GEM
|
2
2
|
remote: http://rubygems.org/
|
3
3
|
specs:
|
4
|
-
|
5
|
-
|
6
|
-
|
4
|
+
activesupport (4.2.6)
|
5
|
+
i18n (~> 0.7)
|
6
|
+
json (~> 1.7, >= 1.7.7)
|
7
|
+
minitest (~> 5.1)
|
8
|
+
thread_safe (~> 0.3, >= 0.3.4)
|
9
|
+
tzinfo (~> 1.1)
|
10
|
+
addressable (2.3.8)
|
11
|
+
climate_control (0.0.3)
|
12
|
+
activesupport (>= 3.0)
|
13
|
+
crack (0.4.3)
|
14
|
+
safe_yaml (~> 1.0.0)
|
7
15
|
diff-lcs (1.2.5)
|
8
|
-
faraday (0.
|
9
|
-
multipart-post (
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
rspec (2.14.1)
|
28
|
-
rspec-core (~> 2.14.0)
|
29
|
-
rspec-expectations (~> 2.14.0)
|
30
|
-
rspec-mocks (~> 2.14.0)
|
31
|
-
rspec-core (2.14.7)
|
32
|
-
rspec-expectations (2.14.4)
|
16
|
+
faraday (0.9.2)
|
17
|
+
multipart-post (>= 1.2, < 3)
|
18
|
+
hashdiff (0.3.0)
|
19
|
+
highline (1.7.8)
|
20
|
+
i18n (0.7.0)
|
21
|
+
json (1.8.3)
|
22
|
+
minitest (5.8.4)
|
23
|
+
multipart-post (2.0.0)
|
24
|
+
netrc (0.11.0)
|
25
|
+
octokit (4.3.0)
|
26
|
+
sawyer (~> 0.7.0, >= 0.5.3)
|
27
|
+
rake (11.1.1)
|
28
|
+
redcarpet (3.3.4)
|
29
|
+
rspec (2.99.0)
|
30
|
+
rspec-core (~> 2.99.0)
|
31
|
+
rspec-expectations (~> 2.99.0)
|
32
|
+
rspec-mocks (~> 2.99.0)
|
33
|
+
rspec-core (2.99.2)
|
34
|
+
rspec-expectations (2.99.2)
|
33
35
|
diff-lcs (>= 1.1.3, < 2.0)
|
34
|
-
rspec-mocks (2.
|
36
|
+
rspec-mocks (2.99.4)
|
35
37
|
rugged (0.18.0.gh.de28323)
|
36
|
-
safe_yaml (0.
|
37
|
-
|
38
|
-
|
39
|
-
|
38
|
+
safe_yaml (1.0.4)
|
39
|
+
sawyer (0.7.0)
|
40
|
+
addressable (>= 2.3.5, < 2.5)
|
41
|
+
faraday (~> 0.8, < 0.10)
|
42
|
+
thread_safe (0.3.5)
|
43
|
+
trollop (2.1.2)
|
44
|
+
tzinfo (1.2.2)
|
45
|
+
thread_safe (~> 0.1)
|
46
|
+
vcr (3.0.1)
|
47
|
+
webmock (1.24.2)
|
48
|
+
addressable (>= 2.3.6)
|
40
49
|
crack (>= 0.3.2)
|
41
|
-
|
50
|
+
hashdiff
|
51
|
+
yard (0.8.7.6)
|
42
52
|
|
43
53
|
PLATFORMS
|
44
54
|
ruby
|
45
55
|
|
46
56
|
DEPENDENCIES
|
47
|
-
addressable (~> 2.3)
|
48
|
-
|
49
|
-
highline (
|
57
|
+
addressable (~> 2.3.5)
|
58
|
+
climate_control (~> 0.0.3)
|
59
|
+
highline (~> 1.7)
|
50
60
|
json (~> 1.8)
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
61
|
+
netrc (~> 0.11)
|
62
|
+
octokit (~> 4.3)
|
63
|
+
rake
|
64
|
+
redcarpet
|
65
|
+
rspec (~> 2.99)
|
55
66
|
rugged (~> 0.18.0.gh.de28323)
|
56
|
-
trollop (~> 1
|
57
|
-
|
58
|
-
|
67
|
+
trollop (~> 2.1)
|
68
|
+
vcr
|
69
|
+
webmock (~> 1.24)
|
70
|
+
yard
|
71
|
+
|
72
|
+
BUNDLED WITH
|
73
|
+
1.11.2
|
data/LICENSE
CHANGED
data/{README.md → README.adoc}
RENAMED
@@ -1,62 +1,63 @@
|
|
1
|
-
|
1
|
+
https://travis-ci.org/jdigger/git-process[image:https://travis-ci.org/jdigger/git-process.png?branch=master[Build Status]]
|
2
2
|
|
3
|
-
|
3
|
+
= Purpose
|
4
4
|
|
5
5
|
This provides an easy way to work with a sane git workflow process that encourages using highly-focused branches to encourage collaboration, enable fearless changes, and improve team communication.
|
6
6
|
|
7
7
|
See the F.A.Q. for a much more complete explanation for the thoughts and assumptions that motivates this project.
|
8
8
|
|
9
|
+
= Installation
|
9
10
|
|
10
|
-
|
11
|
+
== Unix-based OS (OSX, Linux, etc.) Installation
|
11
12
|
|
12
|
-
|
13
|
-
|
14
|
-
If you are using a Ruby sandboxing system like [RVM](https://rvm.io/) or [rbenv](https://github.com/sstephenson/rbenv)
|
13
|
+
If you are using a Ruby sandboxing system like https://rvm.io[RVM] or https://github.com/sstephenson/rbenv[rbenv]
|
15
14
|
(either or which I would recommend) then simply do:
|
16
15
|
|
17
|
-
|
16
|
+
$ gem install git-process
|
18
17
|
|
19
18
|
If you are not using RVM or rbenv, you will likely need to precede that with "`sudo`".
|
20
19
|
|
21
20
|
Some older operating systems (such as OSX 10.6) are using an old version of RubyGems, which can cause installation problems. Do "`gem update --system`" to fix.
|
22
21
|
|
23
|
-
|
22
|
+
== Windows Installation
|
24
23
|
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
24
|
+
. Install Ruby (if you have not done so already) from http://rubyinstaller.org/
|
25
|
+
** If it complains about not being able to compile native code, install http://rubyinstaller.org/downloads[DevKit].
|
26
|
+
** See http://stackoverflow.com/questions/8100891/the-json-native-gem-requires-installed-build-tools/8463500#8463500[this StackOverflow] for help.
|
27
|
+
. Open a command prompt and type `gem install git-process`
|
28
|
+
. _THERE IS A KNOWN PROBLEM WITH link:../../issues/140[HELP ON WINDOWS]_ link:../../issues/140[(GH-120)].
|
30
29
|
|
31
|
-
|
30
|
+
== Ruby Compatibility
|
32
31
|
|
33
|
-
|
32
|
+
Currently tested and maintained against Ruby 2.0 and Ruby 2.3
|
34
33
|
|
35
|
-
|
36
|
-
$ git config --global man.viewer gem-man
|
37
|
-
$ alias man="gem man -s"
|
34
|
+
== All Operating Systems
|
38
35
|
|
36
|
+
To get full `git help` and manpage support, do:
|
39
37
|
|
40
|
-
|
38
|
+
$ git config --global man.gem-man.cmd "gem man -s"
|
39
|
+
$ git config --global man.viewer gem-man
|
40
|
+
$ alias man="gem man -s"
|
41
41
|
|
42
|
-
|
42
|
+
= Overview
|
43
43
|
|
44
|
-
|
45
|
-
1. User pushes local branch to remote (as feature branch) by merging/rebasing with the integration branch, then pushing to the branch to remote.
|
46
|
-
1. User closes local branch by rebasing integration branch first, then pushing local to integration.
|
47
|
-
1. User initiates GitHub "pull request" to ease collaboration.
|
44
|
+
== Anticipated Use Cases
|
48
45
|
|
49
|
-
|
46
|
+
. User creates new local branch for focused work.
|
47
|
+
. User pushes local branch to remote (as feature branch) by merging/rebasing with the integration branch, then pushing to the branch to remote.
|
48
|
+
. User initiates GitHub "pull request" to ease collaboration.
|
49
|
+
. User closes local branch by rebasing integration branch first, then pushing local to integration.
|
50
|
+
|
51
|
+
== Command List
|
50
52
|
|
51
53
|
* `git new-fb` - Create a new feature branch based on the integration branch.
|
52
54
|
* `git sync` - Gets the latest changes that have happened on the integration branch and remote feature branch, then pushes your changes to a feature branch on the server.
|
53
55
|
* `git pull-req` - Create or get a Pull Request for the current branch.
|
54
56
|
* `git to-master` - Rebase against the integration branch, then pushes to it. Knows how to deal "intelligently" with pull-requests.
|
55
57
|
|
56
|
-
|
57
|
-
|
58
|
+
*All commands are well documented within themselves: Use the "git help" to see the full documentation.* (e.g., "`git help sync`")
|
58
59
|
|
59
|
-
|
60
|
+
== Configurables
|
60
61
|
|
61
62
|
(See Notes for more details)
|
62
63
|
|
@@ -65,18 +66,16 @@ To get full `git help` and manpage support, do:
|
|
65
66
|
* `gitProcess.remoteName` : Explicitly sets the remote server name to use.
|
66
67
|
* `gitProcess.defaultRebaseSync`: Should `git sync` default to using rebase instead of merge? Defaults to 'true' (i.e., Sync using rebase.)
|
67
68
|
|
69
|
+
= Assumptions
|
68
70
|
|
69
|
-
|
70
|
-
|
71
|
-
* You should **_never_** do any work directly on "`master`" (or whatever you define the mainline branch as): everything is done on a feature branch. This is a much safer and more flexible practice than doing everything on the same branch, but may seem odd to people used to old VCSs. In addition to being a much better way of working in general (see the F.A.Q. for more information), it is also a requirement to take advantage of Pull Request functionality.
|
71
|
+
* You should *_never_* do any work directly on "`master`" (or whatever you define the mainline branch as): everything is done on a feature branch. This is a much safer and more flexible practice than doing everything on the same branch, but may seem odd to people used to old VCSs. In addition to being a much better way of working in general (see the F.A.Q. for more information), it is also a requirement to take advantage of Pull Request functionality.
|
72
72
|
* When working on a branch, you should be integrating with "`master`" as often as possible.
|
73
|
-
|
74
|
-
|
73
|
+
** "`git sync`" makes it extremely easy for you to get any changes that are made in "`master`" into your branch so you can react to it immediately.
|
74
|
+
** "`git to-master`" then makes it easy to cleanly integrate the changes you have made. If you need to keep the current branch open, use the `--keep` option. Otherwise it closes the branch along with various other house-keeping duties.
|
75
75
|
* The process that you use should be essentially the same, regardless of whether you are working alone, or on a large distributed team.
|
76
|
-
|
77
|
-
|
76
|
+
** The exception here is "`git pull-req`" since you typically do not use pull requests when working solo or when pair-programming.
|
78
77
|
|
79
|
-
|
78
|
+
= Notes
|
80
79
|
|
81
80
|
* After publishing changes to the main integration branch (i.e., "`git to-master`") the old feature branch is removed as part of cleanup. Git is then "parked" on a "`_parking_`" branch until a new feature branch is created. Work is not expected to be done on this branch, but any that is done is brought over to a newly created feature branch (i.e., "`git new-fb`").
|
82
81
|
* If there is a problem (such as a merge conflict), this will try to resolve such errors for you as much as it can do safely. When it can't do so in an automated way, it will try to tell you the process for doing so manually.
|
@@ -85,98 +84,96 @@ To get full `git help` and manpage support, do:
|
|
85
84
|
* By default the first server name reported by `git remote` is used as the server/remote name. Since most projects only have a single remote (i.e., "origin") this works most of the time. But if you have multiple remotes and want to explicitly set it, use the `gitProcess.remoteName` configuration option.
|
86
85
|
* `git pull-req` shows the URL for the pull request after creating it on the server. Most terminal programs let you click on it to open it in your browser. (e.g., Cmd-Click on OSX.)
|
87
86
|
|
87
|
+
= Workflow Examples
|
88
88
|
|
89
|
-
|
90
|
-
|
91
|
-
## Working Alone On A Local-Only Project ##
|
89
|
+
== Working Alone On A Local-Only Project
|
92
90
|
|
93
91
|
Jim is working on "my_project" and needs to start work on a new feature.
|
94
92
|
|
95
|
-
|
93
|
+
----
|
96
94
|
[a_branch]$ git new-fb save_the_planet
|
97
95
|
Creating save_tp off of master
|
98
96
|
[save_the_planet]$
|
99
|
-
|
97
|
+
----
|
100
98
|
|
101
99
|
He does lots of work. Checkin, checkin, checkin.
|
102
100
|
|
103
101
|
A sudden new brilliant idea happens.
|
104
102
|
|
105
|
-
|
103
|
+
----
|
106
104
|
[save_the_planet]$ git new-fb shave_the_bunnies
|
107
105
|
Creating shave_the_bunnies off of master
|
108
106
|
[shave_the_bunnies]$
|
109
|
-
|
107
|
+
----
|
110
108
|
|
111
109
|
After creating a Sheering class and tests, he commits his changes.
|
112
110
|
|
113
|
-
|
111
|
+
----
|
114
112
|
[shave_the_bunnies]$ git commit
|
115
113
|
[shave_the_bunnies]$ git to-master
|
116
114
|
Rebasing shave_the_bunnies against master
|
117
115
|
Removing branch 'shave_the_bunnies'
|
118
116
|
[_parking_]$
|
119
|
-
|
117
|
+
----
|
120
118
|
|
121
119
|
Time to get back to work on "save_the_planet".
|
122
120
|
|
123
|
-
|
121
|
+
----
|
124
122
|
[_parking_]$ git checkout save_the_planet
|
125
123
|
[save_the_planet]$ git sync
|
126
124
|
Rebasing save_the_planet against master
|
127
125
|
[save_the_planet]$
|
128
|
-
|
126
|
+
----
|
129
127
|
|
130
128
|
Do more work. Commit. Commit. Commit.
|
131
129
|
|
132
|
-
|
130
|
+
----
|
133
131
|
[save_the_planet]$ git sync
|
134
132
|
Rebasing save_the_planet against master
|
135
133
|
[save_the_planet]$
|
136
|
-
|
134
|
+
----
|
137
135
|
|
138
136
|
Liking to have a clean history, he squashes and edits the commits to hide
|
139
137
|
the evidence of false starts and stupid ideas so that anyone who sees the
|
140
138
|
code in the future will think he was simply a genius.
|
141
139
|
|
142
|
-
|
140
|
+
----
|
143
141
|
[save_the_planet]$ git rebase -i
|
144
142
|
Rebasing save_the_planet against master
|
145
143
|
[save_the_planet]$ git to-master
|
146
144
|
Rebasing save_the_planet against master
|
147
145
|
Removing branch 'save_the_planet'
|
148
146
|
[_parking_]$
|
149
|
-
|
147
|
+
----
|
150
148
|
|
151
149
|
Time to release to a grateful world.
|
152
150
|
|
153
|
-
|
154
|
-
## Working With A Team ##
|
151
|
+
== Working With A Team
|
155
152
|
|
156
153
|
John, Alice, Bill and Sally are working on "big_monies." Alice and John are pairing and
|
157
154
|
need to start work on a new feature.
|
158
155
|
|
159
|
-
|
156
|
+
----
|
160
157
|
john-[a_branch]$ git new-fb steal_underpants
|
161
158
|
Fetching the latest changes from the server
|
162
159
|
Creating steal_underpants off of origin/master
|
163
160
|
john-[steal_underpants]$
|
164
|
-
|
161
|
+
----
|
165
162
|
|
166
163
|
They do lots of work. Checkin, checkin, checkin. It has a lot of steps...
|
167
164
|
|
168
165
|
Meanwhile Bill has been working on his great idea:
|
169
166
|
|
170
|
-
|
167
|
+
----
|
171
168
|
bill-[some_branch]$ git new-fb awesomo4000
|
172
169
|
Fetching the latest changes from the server
|
173
170
|
Creating awesomo4000 off of origin/master
|
174
171
|
bill-[awesomo4000]$
|
175
|
-
|
172
|
+
----
|
176
173
|
|
177
174
|
He creates his "Laaaaame" class and checks it in, with a pull request asking Sally to do a code review.
|
178
175
|
|
179
|
-
|
176
|
+
----
|
180
177
|
bill-[awesomo4000]$ git commit
|
181
178
|
bill-[awesomo4000]$ git pull-req "A.W.E.S.O.M-0 4000 prototype" \
|
182
179
|
-d "@sally, can you make sure Butters won't recognize it?"
|
@@ -184,11 +181,11 @@ bill-[awesomo4000]$ git pull-req "A.W.E.S.O.M-0 4000 prototype" \
|
|
184
181
|
Creating a pull request asking for 'awesomo4000' to be merged into 'master' on big_monies.
|
185
182
|
Created pull request at https://github.com/big_monies/pull/3454
|
186
183
|
bill-[awesomo4000]$
|
187
|
-
|
184
|
+
----
|
188
185
|
|
189
186
|
Sally sees the email. After looking at it in the web interface, she wants to test it.
|
190
187
|
|
191
|
-
|
188
|
+
----
|
192
189
|
sally-[other_branch]$ git pull-req 3454
|
193
190
|
Getting #pr_number
|
194
191
|
Fetching the latest changes from the server
|
@@ -199,11 +196,11 @@ sally-[awesomo4000]$ git sync
|
|
199
196
|
Rebasing awesomo4000 against origin/master
|
200
197
|
Pushing to 'awesomo4000' on 'origin'.
|
201
198
|
sally-[awesomo4000]$
|
202
|
-
|
199
|
+
----
|
203
200
|
|
204
201
|
After verifying that the tests still work and "it's all good" she promotes the code to integration.
|
205
202
|
|
206
|
-
|
203
|
+
----
|
207
204
|
sally-[awesomo4000]$ git to-master
|
208
205
|
Fetching the latest changes from the server
|
209
206
|
Rebasing awesomo4000 against origin/master
|
@@ -212,32 +209,32 @@ sally-[awesomo4000]$ git to-master
|
|
212
209
|
Removing branch local 'awesomo4000'
|
213
210
|
Closing a pull request #3454 on origin.
|
214
211
|
sally-[_parking_]$
|
215
|
-
|
212
|
+
----
|
216
213
|
|
217
214
|
Over lunch Alice gets a brainstorm ("a duck and rubber hose!") and rushes off to her computer:
|
218
215
|
|
219
|
-
|
216
|
+
----
|
220
217
|
alice-[lens_cap]$ git sync steal_underpants
|
221
218
|
Fetching the latest changes from the server
|
222
219
|
Creating steal_underpants off of origin/steal_underpants
|
223
220
|
Setting upstream/tracking for branch 'steal_underpants' to 'origin/master'.
|
224
221
|
alice-[steal_underpants]$
|
225
|
-
|
222
|
+
----
|
226
223
|
|
227
224
|
She makes her changes, syncs back up with the server, and heads over to pair with John again.
|
228
225
|
|
229
|
-
|
226
|
+
----
|
230
227
|
alice-[steal_underpants]$ git commit
|
231
228
|
alice-[steal_underpants]$ git sync
|
232
229
|
Fetching the latest changes from the server
|
233
230
|
Rebasing steal_underpants against origin/master
|
234
231
|
Pushing to 'steal_underpants' on 'origin'.
|
235
232
|
alice-[steal_underpants]$
|
236
|
-
|
233
|
+
----
|
237
234
|
|
238
235
|
John, meanwhile, had made some changes of his own.
|
239
236
|
|
240
|
-
|
237
|
+
----
|
241
238
|
john-[steal_underpants]$ git commit
|
242
239
|
john-[steal_underpants]$ git sync
|
243
240
|
Fetching the latest changes from the server
|
@@ -246,7 +243,7 @@ john-[steal_underpants]$ git sync
|
|
246
243
|
Rebasing steal_underpants against origin/master
|
247
244
|
Pushing to 'steal_underpants' on 'origin'.
|
248
245
|
john-[steal_underpants]$
|
249
|
-
|
246
|
+
----
|
250
247
|
|
251
248
|
At this point, his local branch has Alice's change as well as Bill and
|
252
249
|
Sally's A.W.E.S.O.M-O 4000 enhancements.
|
@@ -254,7 +251,7 @@ Sally's A.W.E.S.O.M-O 4000 enhancements.
|
|
254
251
|
After confirming with Alice and Bill that everything looks good, he
|
255
252
|
pushes his changes up for integration.
|
256
253
|
|
257
|
-
|
254
|
+
----
|
258
255
|
john-[steal_underpants]$ git to-master
|
259
256
|
Fetching the latest changes from the server
|
260
257
|
Rebasing steal_underpants against origin/master
|
@@ -262,59 +259,70 @@ john-[steal_underpants]$ git to-master
|
|
262
259
|
Removing remote branch 'steal_underpants'
|
263
260
|
Removing local branch 'steal_underpants'
|
264
261
|
[_parking_]$
|
265
|
-
|
262
|
+
----
|
266
263
|
|
267
264
|
Profit!!
|
268
265
|
|
266
|
+
= F.A.Q.
|
269
267
|
|
270
|
-
|
271
|
-
|
272
|
-
## Q: How is this different from git-flow or GitHub flow? ##
|
268
|
+
== Q: How is this different from git-flow or GitHub flow?
|
273
269
|
|
274
|
-
|
270
|
+
http://nvie.com/posts/a-successful-git-branching-model["git-flow"] is designed around having a very strongly defined process around keeping new development, hotfixes, release process changes, etc. all clearly separated. The problem I have with it is that it's too much "process" for not enough gain. (It has a waterfall feel to it, very much against the more modern http://continuousdelivery.com[Continuous Delivery] approach.)
|
275
271
|
|
276
|
-
|
272
|
+
http://scottchacon.com/2011/08/31/github-flow.html["GitHub Flow"] is a lot cleaner, but relies too heavily (IMHO) on web-based tools and on merging instead of rebasing. It is also focussed very tightly on a Continuous Deployment process, which is great for them, but not practical for everyone.
|
277
273
|
|
278
|
-
|
279
|
-
## Q: Wait, I heard "branches are evil." Why should I do something evil? ##
|
274
|
+
== Q: Wait, I heard "branches are evil." Why should I do something evil?
|
280
275
|
|
281
276
|
Branches are extremely powerful tools that allow for clean organization/modularization of development.
|
282
277
|
|
283
278
|
* Branches make it easy to sandbox changes while they are in a state of flux, while at the same time allowing you to be very fearless about making potentially breaking changes.
|
284
|
-
|
285
|
-
|
279
|
+
** For example, I commit "green to green": Doing http://en.wikipedia.org/wiki/Test-driven_development[TDD], I commit every time I have a newly passing test case. So, assuming I'm in a regular development flow, I'm committing my changes every five minutes or so. Tiny commits, but lots of them. What that means is that if I make a "less than wise choice" at some point, it's trivial to rewind to before I'd made the mistake, potentially keep the throw-away code in another branch while I do my cleanup, and generally use the full power of a revision control system to make my life safer and easier. The branch(es) are pretty chaotic, but that's not a problem because before integrating with the mainline, I take a moment to cleanup: Squash related commits together, write clearer commit messages (since now I know what "the answer" is), and generally move from my drafts to a more finished result. (See below on objections related to "lying with rebase.") That may just be me, though, because I'm very paranoid when it comes to computers. I tend to automatically hit Cmd/Ctl-S every time I type a period when I'm writing, or when I close a block when I'm programming. I have a minimum of three copies/backups around the world of all my important documents. And I "`git sync`" frequently to make sure my machine isn't the only place where all my hard work is being stored. Have I mentioned I don't trust computers?
|
286
280
|
* Branches allow for focused collaboration. Because a branch is about exactly one thing, it means that a team can collaborate around a feature/bug (especially when used in conjunction with a "pull request"), and keep such changes sandboxed until such time that they are ready to bring a larger audience into the mix.
|
287
|
-
|
288
|
-
|
289
|
-
Jez Humble, a brilliant Principle at ThoughtWorks Studios, talks a lot about how "branches are evil." Unfortunately, people hear that, know how smart he is, and simply repeat it without really understanding what his objections are. Fortunately, he [posted clarification about what's really meant by that](http://continuousdelivery.com/2011/07/on-dvcs-continuous-integration-and-feature-branches/). He essentially says that the problem is that developers abuse branches by not merging with mainline (i.e., "master") on a regular basis. Not constantly getting changes *from* mainline makes life rough when it comes time to integrate. Not putting your changes *into* mainline means that your changes are not being validated (via [Continuous Integration](http://martinfowler.com/articles/continuousIntegration.html), or -- better -- with [Continuous Delivery](http://continuousdelivery.com/)). Both are, in fact, sins akin to not doing automated testing.
|
281
|
+
** Branches encourage being less "shy" about your code. I have heard, on a number of occasions, developers say "I'm not ready to push this to the server yet because [it's still rough (and embarrassing)]/[it may break other people]/etc." All of those reasons for "hoarding" code are moot with branches.
|
290
282
|
|
291
|
-
|
283
|
+
Jez Humble, a brilliant Principle at ThoughtWorks Studios, talks a lot about how "branches are evil." Unfortunately, people hear that, know how smart he is, and simply repeat it without really understanding what his objections are. Fortunately, he http://continuousdelivery.com/2011/07/on-dvcs-continuous-integration-and-feature-branches[posted clarification about what's really meant by that]. He essentially says that the problem is that developers abuse branches by not merging with mainline (i.e., "master") on a regular basis. Not constantly getting changes _from_ mainline makes life rough when it comes time to integrate. Not putting your changes _into_ mainline means that your changes are not being validated (via http://martinfowler.com/articles/continuousIntegration.html[Continuous Integration], or - better - with http://continuousdelivery.com[Continuous Delivery]). Both are, in fact, sins akin to not doing automated testing.
|
292
284
|
|
285
|
+
Making it "easier to do things right than wrong" (i.e., using branches and keeping them synced with mainline) was the primary motivation for this project. Every command here is focused on making it trivial to use branches that stay in sync with mainline and encourage collaboration.
|
293
286
|
|
294
|
-
|
287
|
+
== Q: Why so much emphasis on rebasing? Isn't rebasing a dangerous lie?
|
295
288
|
|
296
|
-
Like any powerful tool,
|
289
|
+
Like any powerful tool, `git rebase` is "dangerous" if used incorrectly, just like `rm`/`del`. You simply need to know when and how to use it safely. And in the world of version control systems, "`rebasing`" is easily one of the most _*useful*_ tools to come around since the `commit` command.
|
297
290
|
|
298
|
-
|
291
|
+
http://paul.stadig.name/2010/12/thou-shalt-not-lie-git-rebase-ammend.html[A famous article] that people have been parroting in various forms for a while makes the case that rebasing (and its various forms, such as squashing, amending commits, etc.) is a "lie." As with so many things, context is everything.
|
299
292
|
|
300
|
-
You almost certainly should
|
293
|
+
You almost certainly should _not_ rebase things that you have "`published.`" Generally this really means "`Don't rebase the 'master' branch!`" Fortunately, these scripts make it impossible to rebase the mainline by accident.
|
301
294
|
|
302
|
-
Rebasing "your" code is an extremely useful way of communicating clearly. In the "green to green" scenario above about branches, a lot of noise is generated. If someone wants to review my code, or cherry-pick in my changes, it's too much of a mess to effectively do so. Also, as part of the process of squashing, I have the opportunity to write clearer commit message based upon my newly enhanced understanding. The intermediate commits were my "drafts" and I'm now submitting my cleaned up copy.
|
295
|
+
Rebasing "`your`" code is an extremely useful way of communicating clearly. In the "green to green" scenario above about branches, a lot of noise is generated. If someone wants to review my code, or cherry-pick in my changes, it's too much of a mess to effectively do so. Also, as part of the process of squashing, I have the opportunity to write clearer commit message based upon my newly enhanced understanding. The intermediate commits were my "drafts" and I'm now submitting my cleaned up copy.
|
303
296
|
|
304
|
-
If you have ever seen an "active" project that uses a process like "git-flow" that encourages a lot of branching and merging, you've seen how hard it can be to follow a particular line of development. Branch lines are flying around everywhere, and half the commits are pretty much pure noise. (e.g., "Merge branch 'master' of ... into master".) It's also hard to follow the order in which commits actually impacted the mainline. In many ways, in practice merges turn into "a truth effectively being a lie" (because it's buried in the noise) versus rebases that are "a lie (changed from it's 'original' form) to tell an effective truth" (clean and very clear about its impact).
|
297
|
+
If you have ever seen an "active" project that uses a process like "`git-flow`" that encourages a lot of branching and merging, you've seen how hard it can be to follow a particular line of development. Branch lines are flying around everywhere, and half the commits are pretty much pure noise. (e.g., "Merge branch 'master' of ... into master".) It's also hard to follow the order in which commits actually impacted the mainline. In many ways, in practice merges turn into "`a truth effectively being a lie`" (because it's buried in the noise) versus rebases that are "a lie (changed from it's 'original' form) to tell an effective truth" (clean and very clear about its impact).
|
305
298
|
|
306
|
-
One significant advantage of using automation like this is that it lets you have the best of both worlds. For example,
|
299
|
+
One significant advantage of using automation like this is that it lets you have the best of both worlds. For example, `git sync` uses "`rebase`" instead of "`merge`" in a way to is completely safe for collaboration on the same branch. As long as the other people are also using `git sync`, it will make sure that changes are automatically incorporated with and brought in line. (See the extensive test suite in link:spec/sync_spec.rb[sync_spec.rb] if you want to see how this works.)
|
307
300
|
|
308
301
|
This project is trying to promote clear communication about reality as it applies to the code, over micro-management over no-longer-relevant history. Thus rational for the judicious use of rebase.
|
309
302
|
|
303
|
+
= Development
|
304
|
+
|
305
|
+
Uses https://github.com/sstephenson/rbenv[rbenv] for Ruby versioning and http://bundler.io/[Bundler] for Gem management.
|
306
|
+
|
307
|
+
To get started, install rbenv and Bundler, then `bundle install`
|
308
|
+
|
309
|
+
Most tasks are run using http://rake.rubyforge.org/[Rake], defined in link:./Rakefile[`Rakefile`]
|
310
|
+
|
311
|
+
* `rake spec` (default) - Runs the http://rspec.info/[RSpec] tests
|
312
|
+
* `rake yard` - Generates the API documentation as HTML into the `doc` subdirectory
|
313
|
+
* `rake manpage` `rake htmldoc` - Generates command documentation as man pages or HTML (respectively) using http://asciidoc.org/a2x.1.html[a2x]
|
314
|
+
|
315
|
+
The scripts themselves are in the link:./bin[`bin`] directory, whereas the logic is in the link:./lib/git-process[`lib/git-process`] directory. Test specifications are in link:./spec[`spec`]
|
316
|
+
|
317
|
+
For local testing of the generated Gems, link:./local-build.rb[`local-build.rb`] will uninstall the current `git-process` gems and install the the new ones.
|
310
318
|
|
311
|
-
|
319
|
+
= License
|
312
320
|
|
313
321
|
Licensed under the Apache License, Version 2.0 (the "License");
|
314
322
|
you may not use this file except in compliance with the License.
|
315
323
|
You may obtain a copy of the License at
|
316
324
|
|
317
|
-
|
325
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
318
326
|
|
319
327
|
Unless required by applicable law or agreed to in writing, software
|
320
328
|
distributed under the License is distributed on an "AS IS" BASIS,
|