git-rollback 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +15 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +19 -0
- data/Rakefile +1 -0
- data/bin/git-rollback +23 -0
- data/git-rollback.gemspec +26 -0
- data/lib/git-rollback.rb +30 -0
- data/lib/git-rollback/version.rb +3 -0
- data/man/.gitkeep +0 -0
- metadata +98 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 56d4d8ead2699d5bc18c5bc8c8a13173baa73a1c
|
4
|
+
data.tar.gz: 7a92077c1936cd3cc14299eee89a61627efeb85c
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 618cd1b9ef30be3acd636687ae32417d6d8fb0cbe1b7f580795da0d59a8209d5c41a0eb76c85efebf2a82dbe39c946386c98acaea4ae4acb79558503f074c7bc
|
7
|
+
data.tar.gz: 572a0f90dc2ced07681d81815ec50176a893dd8b4ecfa2f659a2f910ca43951da5fcee09e567ced03f39d2bc0216984b54513ab88ff3bdf89ab4c261ddeb3c60
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2014 Bin Huang
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
# git-rollback(alpha)
|
2
|
+
|
3
|
+
Easily rollback last several commits.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
$ gem install git-rollback
|
8
|
+
|
9
|
+
## Usage
|
10
|
+
|
11
|
+
$ git rollback
|
12
|
+
|
13
|
+
## Contributing
|
14
|
+
|
15
|
+
1. Fork it ( https://github.com/hbin/git-rollback/fork )
|
16
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
17
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
18
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
19
|
+
5. Create a new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
data/bin/git-rollback
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
#!/usr/bin/env ruby -w
|
2
|
+
# -*- coding: utf-8 -*-
|
3
|
+
|
4
|
+
require 'git-rollback'
|
5
|
+
|
6
|
+
command_ran = false
|
7
|
+
|
8
|
+
opts = Slop.parse!(help: true) do
|
9
|
+
description 'Git rollback commits'
|
10
|
+
|
11
|
+
on '--soft', 'Delete the commit but leave all your changed files.'
|
12
|
+
on '--hard', 'Git rid of any changes to tracked files.'
|
13
|
+
|
14
|
+
on '-v', '--version', 'Print the version' do
|
15
|
+
puts "Version #{GitRollback::VERSION}"
|
16
|
+
|
17
|
+
command_ran = true
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
if not command_ran
|
22
|
+
GitRollback.new.run(opts, ARGV)
|
23
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
|
5
|
+
require 'git-rollback/version'
|
6
|
+
|
7
|
+
Gem::Specification.new do |s|
|
8
|
+
s.name = "git-rollback"
|
9
|
+
s.version = GitRollback::VERSION
|
10
|
+
s.authors = ["Bin Huang"]
|
11
|
+
s.email = ["huangbin88@foxmail.com"]
|
12
|
+
s.summary = %q{Easily rollback commits.}
|
13
|
+
s.description = %q{Easily rollback last N commits.}
|
14
|
+
s.homepage = "https://github.com/hbin/git-rollback"
|
15
|
+
s.license = "MIT"
|
16
|
+
|
17
|
+
s.files = `git ls-files -z`.split("\x0")
|
18
|
+
s.executables = s.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
19
|
+
s.test_files = s.files.grep(%r{^(test|s|features)/})
|
20
|
+
s.require_paths = ["lib"]
|
21
|
+
|
22
|
+
s.add_runtime_dependency 'slop', '~> 3.6.0'
|
23
|
+
|
24
|
+
s.add_development_dependency "bundler", "~> 1.7"
|
25
|
+
s.add_development_dependency "rake", "~> 10.0"
|
26
|
+
end
|
data/lib/git-rollback.rb
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
require 'slop'
|
2
|
+
|
3
|
+
require "git-rollback/version"
|
4
|
+
|
5
|
+
class GitRollback
|
6
|
+
attr_reader :config
|
7
|
+
|
8
|
+
def initialize
|
9
|
+
@config = {}
|
10
|
+
end
|
11
|
+
|
12
|
+
def run(opts, argv)
|
13
|
+
process_argv(argv)
|
14
|
+
|
15
|
+
command = ['git', 'reset']
|
16
|
+
command << (opts.hard? ? '--hard' : '--soft')
|
17
|
+
command << "HEAD~#{config[:n]}"
|
18
|
+
|
19
|
+
system(*command)
|
20
|
+
end
|
21
|
+
|
22
|
+
def process_argv(argv)
|
23
|
+
case argv
|
24
|
+
when []
|
25
|
+
config[:n] = 1
|
26
|
+
else
|
27
|
+
config[:n] = argv.first || '1'
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
data/man/.gitkeep
ADDED
File without changes
|
metadata
ADDED
@@ -0,0 +1,98 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: git-rollback
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Bin Huang
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-11-11 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: slop
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 3.6.0
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 3.6.0
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: bundler
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.7'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.7'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rake
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '10.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '10.0'
|
55
|
+
description: Easily rollback last N commits.
|
56
|
+
email:
|
57
|
+
- huangbin88@foxmail.com
|
58
|
+
executables:
|
59
|
+
- git-rollback
|
60
|
+
extensions: []
|
61
|
+
extra_rdoc_files: []
|
62
|
+
files:
|
63
|
+
- ".gitignore"
|
64
|
+
- Gemfile
|
65
|
+
- LICENSE.txt
|
66
|
+
- README.md
|
67
|
+
- Rakefile
|
68
|
+
- bin/git-rollback
|
69
|
+
- git-rollback.gemspec
|
70
|
+
- lib/git-rollback.rb
|
71
|
+
- lib/git-rollback/version.rb
|
72
|
+
- man/.gitkeep
|
73
|
+
homepage: https://github.com/hbin/git-rollback
|
74
|
+
licenses:
|
75
|
+
- MIT
|
76
|
+
metadata: {}
|
77
|
+
post_install_message:
|
78
|
+
rdoc_options: []
|
79
|
+
require_paths:
|
80
|
+
- lib
|
81
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
82
|
+
requirements:
|
83
|
+
- - ">="
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: '0'
|
86
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
87
|
+
requirements:
|
88
|
+
- - ">="
|
89
|
+
- !ruby/object:Gem::Version
|
90
|
+
version: '0'
|
91
|
+
requirements: []
|
92
|
+
rubyforge_project:
|
93
|
+
rubygems_version: 2.2.2
|
94
|
+
signing_key:
|
95
|
+
specification_version: 4
|
96
|
+
summary: Easily rollback commits.
|
97
|
+
test_files: []
|
98
|
+
has_rdoc:
|