Class: Command::Reset
- Inherits:
-
Base
- Object
- Base
- Command::Reset
show all
- Defined in:
- lib/command/reset.rb
Instance Attribute Summary
Attributes inherited from Base
#status
Instance Method Summary
collapse
Methods inherited from Base
#execute, #initialize
Constructor Details
This class inherits a constructor from Command::Base
Instance Method Details
#define_options ⇒ Object
9
10
11
12
13
14
15
|
# File 'lib/command/reset.rb', line 9
def define_options
@options[:mode] = :mixed
@parser.on("--soft") { @options[:mode] = :soft }
@parser.on("--mixed") { @options[:mode] = :mixed }
@parser.on("--hard") { @options[:mode] = :hard }
end
|
#run ⇒ Object
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
# File 'lib/command/reset.rb', line 17
def run
select_commit_oid
repo.index.load_for_update
reset_files
repo.index.write_updates
if @args.empty?
head_oid = repo.refs.update_head(@commit_oid)
repo.refs.update_ref(Refs::ORIG_HEAD, head_oid)
end
exit 0
end
|