git-backup 0.2.1 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
- data/Gemfile.lock +0 -2
- data/README.md +9 -9
- data/git-backup.gemspec +0 -1
- data/lib/git-backup/version.rb +1 -1
- data/lib/git-backup.rb +5 -6
- metadata +2 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 89c25d9803ccc9317929b25833501b14cd1ee81e0b1def9bbdbeba2e3d01a32a
|
4
|
+
data.tar.gz: bc3666b308a6f0cc5d80ad2074e172c1df90b09c562c0a643548ac1c02438983
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 544fa87dc58028f8db5728c209ab10114834f6c768fe1797ebd9bbe7bd0d498d0f898cc350905f059411ec0bdbb427cd8494553d11a9bfe73cc80dee4378f391
|
7
|
+
data.tar.gz: 385e376ccbdcaff53f98a7b448dd24d607f090809b7a968d03cde8d4e7d7b2e281e3393ecbac88decf0e120367219df9cdf5463dbc1629f9ec7432574ea437ac
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -1,23 +1,23 @@
|
|
1
1
|
# git-backup
|
2
2
|
|
3
|
-
A lot of Git trouble can be avoided by branching before powerful operations
|
3
|
+
A lot of Git trouble can be avoided by branching before powerful operations such as `rebase`. This Gem adds a Git subcommand called `backup` for making that easy.
|
4
4
|
|
5
|
-
|
5
|
+
Running,
|
6
6
|
|
7
7
|
```shell
|
8
|
-
|
8
|
+
git backup
|
9
9
|
```
|
10
10
|
|
11
|
-
|
11
|
+
Will effectively do,
|
12
12
|
|
13
13
|
```shell
|
14
|
-
git
|
14
|
+
git branch backup/your-current-branch-name-1
|
15
15
|
```
|
16
16
|
|
17
|
-
|
18
|
-
|
19
|
-
|
17
|
+
Running the command more than once for the same branch name will create `backup/your-current-branch-name-2`, `backup/your-current-branch-name-3`, and so on.
|
18
|
+
|
19
|
+
## Installing from RubyGems.org
|
20
20
|
|
21
21
|
```shell
|
22
|
-
sudo
|
22
|
+
sudo gem install git-backup
|
23
23
|
```
|
data/git-backup.gemspec
CHANGED
data/lib/git-backup/version.rb
CHANGED
data/lib/git-backup.rb
CHANGED
@@ -1,14 +1,13 @@
|
|
1
1
|
require "git-backup/version"
|
2
|
-
require "git"
|
3
2
|
|
4
3
|
module GitBackup
|
5
4
|
def self.main
|
6
5
|
current_branch = `git rev-parse --abbrev-ref HEAD`.strip
|
7
|
-
|
8
|
-
number_of_existing_backups =
|
9
|
-
|
6
|
+
local_branches = `git branch`.delete(" ").split("\n")
|
7
|
+
number_of_existing_backups = local_branches.count { |branch| branch =~ /backup\/#{Regexp.quote(current_branch)}-\d+/ }
|
8
|
+
backup_branch_name = "backup/#{current_branch}-#{number_of_existing_backups + 1}"
|
10
9
|
|
11
|
-
`git branch #{
|
12
|
-
puts "Created branch #{
|
10
|
+
`git branch #{backup_branch_name}`
|
11
|
+
puts "Created branch #{backup_branch_name}."
|
13
12
|
end
|
14
13
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: git-backup
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Caleb St-Denis
|
@@ -38,20 +38,6 @@ dependencies:
|
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '10.0'
|
41
|
-
- !ruby/object:Gem::Dependency
|
42
|
-
name: git
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
44
|
-
requirements:
|
45
|
-
- - ">="
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: '0'
|
48
|
-
type: :runtime
|
49
|
-
prerelease: false
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
51
|
-
requirements:
|
52
|
-
- - ">="
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: '0'
|
55
41
|
description: This gem adds a subcommand `git backup`. All the subcommand does is `git
|
56
42
|
branch backup/your-current-branch-name`.
|
57
43
|
email:
|
@@ -88,8 +74,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
88
74
|
- !ruby/object:Gem::Version
|
89
75
|
version: '0'
|
90
76
|
requirements: []
|
91
|
-
|
92
|
-
rubygems_version: 2.5.2.3
|
77
|
+
rubygems_version: 3.0.3
|
93
78
|
signing_key:
|
94
79
|
specification_version: 4
|
95
80
|
summary: A Git subcommand for pre-empting troubles caused by powerful commands such
|