git-utils 2.0.0 → 2.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c558401be11b46c831946e0d92fc292c9f559c7992ead65979373bc0d4703a49
4
- data.tar.gz: 3e3d7516ce925568cf030f2391ff72de690affefc363febe203420bc60b818d3
3
+ metadata.gz: dc7e18850e6bd2ccc17a911e1884c00df08f8318686ccfd90970a8d6b323f7c2
4
+ data.tar.gz: 1bc5d574a523470425b0fefc1dcb69e80c58ffb0597cf575c22dfb987332f7d5
5
5
  SHA512:
6
- metadata.gz: c92927ab40c200212b7891affeb7f111012b205d873cf86a2846db362b4c4b6d97134aba209dc96ee870c681a3d2b1e6fdb6bac2bf6fcee88127f7cf1fb5c154
7
- data.tar.gz: 1eaa0ece4ba1638bd21e7724b384e21f41acc0416dc349a6bcb69c9f39036610fb7ee9c5d9d19db472562dc8b2446d196994fbcd4ae054d89cbe4eea3f0a53f7
6
+ metadata.gz: e63b742743af06a52425ff7d4942740d5abd9e272e502b0593a0864b101022d41e2352ebb435719a400a69d6305c6f8fbc04aac95eb9cfd9f4500914764fc3d2
7
+ data.tar.gz: 56c86af4c83ac1a1af52cdca22a3386de105d6c00eca53b5dd01b3d9789cdaa6cb725022891b24735a5adf1abae7cab04aaa9ff7756f03e3bddf746bdc599bc7
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Git utilities
2
2
 
3
- This repo contains some Git utility scripts. The highlights are `git open`, `git pull-request`, `git push-branch`, and `git undo`, which you'll never understand how you did without.
3
+ This repo contains some Git utility scripts. The highlights are `git open`, `git pull-request`, `git push-branch`, and `git undo`, which youll never understand how you did without.
4
4
 
5
5
  The commands are especially useful when combined with [pivotal-github](https://github.com/mhartl/pivotal-github) gem (which, despite its name, also works with Bitbucket).
6
6
 
@@ -11,18 +11,19 @@ The `git-utils` used to be pure Bash scripts, but they are now available as a Ru
11
11
  ## Commands
12
12
 
13
13
  * `git amend`: alias for `git commit --amend`
14
- * `git bump`: makes a commit with the message "Bump version number"
14
+ * `git bump`: makes a commit with the message `"Bump version number"`
15
15
  * `git cleanup`: deletes every branch already merged into current branch (apart from `master`, `staging`, `development`, and any branches listed in `~/.git-cleanup-preserved`). Pass the `-r` option to delete remote merged branches.
16
16
  * `git merge-into-branch [branch]`: merges current branch into given branch (defaults to `master`)
17
- * `git minor`: makes a commit with the message "Make minor changes"
17
+ * `git minor`: makes a commit with the message `"Make minor changes"`
18
18
  * `git open`: opens the remote page for the repo (OS X & Linux)
19
- * `git polish`: makes a commit with the message "Polish"
19
+ * `git polish`: makes a commit with the message `"Polish"`
20
20
  * `git pull-request`: pushes the branch and opens the remote page for issuing a new a pull request (OS X only)
21
21
  * `git push-branch`: pushes the current branch up to origin
22
22
  * `git delete-remote-branch <branch>`: deletes the remote branch if it is safe to do so
23
23
  * `git switch <pattern>`: switches to the first branch matching the given pattern
24
24
  * `git sync [branch]`: syncs the given branch with the remote branch (defaults to master)
25
- * `git typo`: makes a commit with the message "Fix typo"
25
+ * `git sync-fork`: syncs the `master` branch of a fork with the original upstream `master` (assumes upstream configuration as in “[Configuring a remote for a fork](https://help.github.com/en/github/collaborating-with-issues-and-pull-requests/configuring-a-remote-for-a-fork)”)
26
+ * `git typo`: makes a commit with the message `"Fix typo"`
26
27
  * `git undo`: undoes the last commit
27
28
  * `git graph`: displays full repository history in graphical format; alias for `git log --graph --oneline --decorate --all --full-history --author-date-order --no-notes`
28
29
 
@@ -81,7 +82,7 @@ The main purpose of `git sync` is to prepare the current branch for merging with
81
82
  $ git fetch
82
83
  $ git merge origin/master
83
84
 
84
- but I don't like having `master` and `origin/master` be different since that means you have to remember to run `git pull` on `master` some time down the line.)
85
+ but I dont like having `master` and `origin/master` be different since that means you have to remember to run `git pull` on `master` some time down the line.)
85
86
 
86
87
  ## Installation
87
88
 
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env ruby
2
+ $LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..', 'lib')
3
+ require 'git-utils/sync_fork'
4
+
5
+ # Syncs the local master branch with remote.
6
+ exit Command.run!(SyncFork, ARGV.dup)
@@ -7,4 +7,5 @@ require "git-utils/delete_remote_branch"
7
7
  require "git-utils/push_branch"
8
8
  require "git-utils/switch"
9
9
  require "git-utils/sync"
10
+ require "git-utils/sync_fork"
10
11
  require "git-utils/pull_request"
@@ -0,0 +1,21 @@
1
+ require 'git-utils/command'
2
+
3
+ class SyncFork < Command
4
+
5
+ def parser
6
+ OptionParser.new do |opts|
7
+ opts.banner = "Usage: git sync-fork"
8
+ opts.on_tail("-h", "--help", "this usage guide") do
9
+ puts opts.to_s; exit 0
10
+ end
11
+ end
12
+ end
13
+
14
+ # Returns a command appropriate for executing at the command line.
15
+ def cmd
16
+ c = ["git checkout master"]
17
+ c << "git fetch upstream"
18
+ c << "git merge upstream/master"
19
+ c.join("\n")
20
+ end
21
+ end
@@ -1,5 +1,5 @@
1
1
  module Git
2
2
  module Utils
3
- VERSION = "2.0.0"
3
+ VERSION = "2.1.0"
4
4
  end
5
5
  end
@@ -0,0 +1,17 @@
1
+ require 'spec_helper'
2
+
3
+ describe SyncFork do
4
+
5
+ let(:command) { SyncFork.new }
6
+ subject { command }
7
+
8
+ its(:cmd) { should match /git checkout master/ }
9
+ its(:cmd) { should match /git fetch upstream/ }
10
+ its(:cmd) { should match /git merge upstream\/master/ }
11
+
12
+
13
+ describe "command-line command" do
14
+ subject { `bin/git-sync-fork --debug` }
15
+ it { should match /git fetch upstream/ }
16
+ end
17
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: git-utils
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Hartl
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-04-18 00:00:00.000000000 Z
11
+ date: 2020-05-01 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Add some Git utilities
14
14
  email:
@@ -27,6 +27,7 @@ executables:
27
27
  - git-push-branch
28
28
  - git-switch
29
29
  - git-sync
30
+ - git-sync-fork
30
31
  - git-typo
31
32
  - git-undo
32
33
  extensions: []
@@ -53,6 +54,7 @@ files:
53
54
  - bin/git-push-branch
54
55
  - bin/git-switch
55
56
  - bin/git-sync
57
+ - bin/git-sync-fork
56
58
  - bin/git-typo
57
59
  - bin/git-undo
58
60
  - git-utils.gemspec
@@ -66,6 +68,7 @@ files:
66
68
  - lib/git-utils/push_branch.rb
67
69
  - lib/git-utils/switch.rb
68
70
  - lib/git-utils/sync.rb
71
+ - lib/git-utils/sync_fork.rb
69
72
  - lib/git-utils/version.rb
70
73
  - spec/.DS_Store
71
74
  - spec/commands/.DS_Store
@@ -76,6 +79,7 @@ files:
76
79
  - spec/commands/pull_request_spec.rb
77
80
  - spec/commands/push_branch_spec.rb
78
81
  - spec/commands/switch_spec.rb
82
+ - spec/commands/sync_fork_spec.rb
79
83
  - spec/commands/sync_spec.rb
80
84
  - spec/spec_helper.rb
81
85
  homepage: https://github.com/mhartl/git-utils
@@ -97,8 +101,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
97
101
  - !ruby/object:Gem::Version
98
102
  version: '0'
99
103
  requirements: []
100
- rubyforge_project:
101
- rubygems_version: 2.7.3
104
+ rubygems_version: 3.1.2
102
105
  signing_key:
103
106
  specification_version: 4
104
107
  summary: See the README for full documentation
@@ -112,5 +115,6 @@ test_files:
112
115
  - spec/commands/pull_request_spec.rb
113
116
  - spec/commands/push_branch_spec.rb
114
117
  - spec/commands/switch_spec.rb
118
+ - spec/commands/sync_fork_spec.rb
115
119
  - spec/commands/sync_spec.rb
116
120
  - spec/spec_helper.rb