Skip to content

Commit 67083e1

Browse files
author
TJ Biddle
committed
Adding git clean command.
1 parent 129e798 commit 67083e1

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
@@ -264,6 +264,11 @@ def reset_hard(commitish = nil, opts = {})
264264
self.lib.reset(commitish, opts)
265265
end
266266

267+
def clean(opts = {})
268+
opts = { :force => true, :d => true }.merge(opts)
269+
self.lib.clean(opts)
270+
end
271+
267272
# commits all pending changes in the index file to the git repository
268273
#
269274
# options:

lib/git/lib.rb

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -431,6 +431,13 @@ def reset(commit, opts = {})
431431
arr_opts << commit if commit
432432
command('reset', arr_opts)
433433
end
434+
435+
def clean(opts = {})
436+
arr_opts = []
437+
arr_opts << '--force' if opts[:force]
438+
arr_opts << '-d' if opts[:d]
439+
command('clean', arr_opts)
440+
end
434441

435442
def apply(patch_file)
436443
arr_opts = []

0 commit comments

Comments
 (0)