luislavena-github 0.1.3 → 0.1.4

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.
Files changed (3) hide show
  1. data/README +36 -1
  2. data/commands/commands.rb +11 -0
  3. metadata +1 -1
data/README CHANGED
@@ -17,7 +17,7 @@ Run it:
17
17
 
18
18
 
19
19
  =============
20
- Pulling Changes
20
+ Pulling Upstream Changes
21
21
  =============
22
22
 
23
23
  Let's say you just forked `github-gem` on GitHub from defunkt.
@@ -44,6 +44,40 @@ master branch, use the `merge` flag:
44
44
 
45
45
  $ github pull --merge defunkt
46
46
 
47
+
48
+ ==========
49
+ Fetching and Evaluation Downstream Changes
50
+ ==========
51
+
52
+ If you are the maintainer of a project, you will often need to fetch commits
53
+ from other developers, evaluate and/or test them, then merge them into the
54
+ project.
55
+
56
+ Let's say you are 'defunkt' and 'mojombo' has forked your 'github-gem' repo,
57
+ made some changes and issues you a pull request for his 'master' branch.
58
+
59
+ From the root of the project, you can do:
60
+
61
+ $ github fetch mojombo master
62
+
63
+ This will leave you in the 'mojombo/master' branch after fetching his commits.
64
+ Your local 'mojombo/master' branch is now at the exact same place as mojombo's
65
+ 'master' branch. You can now run tests or evaluate the code for awesomeness.
66
+
67
+ If mojombo's changes are good, you'll want to merge your 'master' (or another
68
+ branch) into those changes so you can retest post-integration:
69
+
70
+ $ git merge master
71
+
72
+ Test/analyze again and if everything is ok:
73
+
74
+ $ git checkout master
75
+ $ git merge mojombo/master
76
+
77
+ The latter command will be a fast-forward merge since you already did the
78
+ real merge previously.
79
+
80
+
47
81
  ==========
48
82
  Contributors
49
83
  ==========
@@ -52,3 +86,4 @@ Contributors
52
86
  - maddox
53
87
  - halorgium
54
88
  - kballard
89
+ - mojombo
data/commands/commands.rb CHANGED
@@ -61,6 +61,17 @@ command :track do |remote, user|
61
61
  end
62
62
  end
63
63
 
64
+ desc "Fetch from a remote to a local branch."
65
+ command :fetch do |user, branch|
66
+ die "Specify a user to pull from" if user.nil?
67
+ user, branch = user.split("/", 2) if branch.nil?
68
+ branch ||= 'master'
69
+ GitHub.invoke(:track, user) unless helper.tracking?(user)
70
+
71
+ git "fetch #{user} #{branch}:refs/remotes/#{user}/#{branch}"
72
+ git_exec "checkout -b #{user}/#{branch} refs/remotes/#{user}/#{branch}"
73
+ end
74
+
64
75
  desc "Pull from a remote."
65
76
  flags :merge => "Automatically merge remote's changes into your master."
66
77
  command :pull do |user, branch|
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: luislavena-github
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Wanstrath, Kevin Ballard