Skip to content

Commit 10b880b

Browse files
committed
added patch from Cassie Schmitz for file checkout
1 parent 8276fac commit 10b880b

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

lib/git/base.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,11 @@ def checkout(branch = 'master', opts = {})
277277
self.lib.checkout(branch, opts)
278278
end
279279

280+
# checks out an old version of a file
281+
def checkout_file(version, file)
282+
self.lib.checkout_file(version,file)
283+
end
284+
280285
# fetches changes from a remote branch - this does not modify the working directory,
281286
# it just gets the changes from the remote if there are any
282287
def fetch(remote = 'origin')

lib/git/lib.rb

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -434,6 +434,13 @@ def checkout(branch, opts = {})
434434

435435
command('checkout', arr_opts)
436436
end
437+
438+
def checkout_file(version, file)
439+
arr_opts = []
440+
arr_opts << version.to_s
441+
arr_opts << file.to_s
442+
command('checkout', arr_opts)
443+
end
437444

438445
def merge(branch, message = nil)
439446
arr_opts = []

0 commit comments

Comments
 (0)