Skip to content

Commit 26e6242

Browse files
author
TJ Biddle
committed
Updating the git pull command so that we can pass in by option the remote and branch, and it will default to whatever is the normal for the current branch. This way we can also pull in a single remote.
1 parent 67083e1 commit 26e6242

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

lib/git/base.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,7 @@ def each_conflict(&block) # :yields: file, your_version, their_version
325325
end
326326

327327
# fetches a branch from a remote and merges it into the current working branch
328-
def pull(remote = 'origin', branch = 'master')
328+
def pull(remote = nil, branch = nil)
329329
self.lib.pull(remote, branch)
330330
end
331331

lib/git/lib.rb

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -514,8 +514,11 @@ def merge(branch, message = nil, arr_opts = [])
514514
command('merge', arr_opts)
515515
end
516516

517-
def pull(remote, branch)
518-
command('pull', [remote, branch])
517+
def pull(remote = nil, branch = nil)
518+
opts = []
519+
opts << remote if remote
520+
opts << branch if branch
521+
command('pull', opts)
519522
end
520523

521524
def unmerged

0 commit comments

Comments
 (0)