Skip to content

Commit 5572a5a

Browse files
author
TJ Biddle
committed
Adding git clean command.
1 parent b79de3a commit 5572a5a

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
@@ -429,6 +429,13 @@ def reset(commit, opts = {})
429429
arr_opts << commit if commit
430430
command('reset', arr_opts)
431431
end
432+
433+
def clean(opts = {})
434+
arr_opts = []
435+
arr_opts << '--force' if opts[:force]
436+
arr_opts << '-d' if opts[:d]
437+
command('clean', arr_opts)
438+
end
432439

433440
def apply(patch_file)
434441
arr_opts = []

0 commit comments

Comments
 (0)