cgit 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +7 -0
  2. data/bin/cgit +67 -0
  3. metadata +59 -0
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: f45fced1af51c1e42f4e3be4c21a7aab54dce3d3
4
+ data.tar.gz: e6fb4135b534cd47f290d353f4a9ef834e4dbb02
5
+ SHA512:
6
+ metadata.gz: d4abb3b3659b2ce7e5c8fb24654d6c7c3aa3ed63752cc927d8a507d6b406554ceb3cf0404e96b2b1167920e71eff94cbaf5b74e7c3c3f0e7ed26aee8dc40586c
7
+ data.tar.gz: ecae2e9cbf10960aeaab346eb5ccdd5d559d01cce6d2427840cb9fd9c0371f8a8c47d8b1ec24649d43aa7141b4f7289816038974330a7229803acf2ab50a9137
@@ -0,0 +1,67 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'Thor'
4
+
5
+ class CGit < Thor
6
+ desc "put MESSAGE", "Adds and commits with a MESSAGE."
7
+ method_option :remote, :aliases => "-r", :desc => "Applies this remotely to the current branch."
8
+ def put(message)
9
+ system ("git add --a .")
10
+ system ("git commit -m \"#{message}\"")
11
+
12
+ remote = options[:remote]
13
+ if remote
14
+ system ("git push origin HEAD")
15
+ end
16
+ end
17
+
18
+ desc "uncommit", "Undoes a commit to the previous HEAD, while keeping the changes."
19
+ def uncommit
20
+ system ("git reset --soft HEAD^")
21
+ end
22
+
23
+ desc "retip COMMIT", "Moves the TIP of the current branch"
24
+ method_option :remote, :aliases => "-r", :desc => "Applies this remotely to the current branch."
25
+ def retip(commit)
26
+ system ("git reset --hard #{commit}")
27
+
28
+ remote = options[:remote]
29
+ if remote
30
+ system ("git push origin HEAD --force")
31
+ end
32
+ end
33
+
34
+ desc "commits", "Displays the commit history tree for the current branch."
35
+ def commits
36
+ system ("git symbolic-ref --short HEAD &
37
+ git log --pretty=format:\"%h %s\" --graph")
38
+ end
39
+
40
+ desc "valid", "Displays unpushed commits to remote in all branches."
41
+ def valid
42
+ puts ("Non pushed commits:")
43
+ system ("git log --branches --not --remotes --decorate --oneline")
44
+ end
45
+
46
+ desc "merge DESTINATION_BRANCH SOURCE_BRANCH", "Pulls latest remote changes on both branches and then merges the SOURCE_BRANCH into the DESTINATION_BRANCH."
47
+ method_option :remote, :aliases => "-r", :desc => "Pushes the merge remotely to the current branch. Be aware that this will not work if there are conflicts."
48
+ def merge(destination_branch, source_branch)
49
+ system ("git checkout #{source_branch}")
50
+ system ("git pull origin #{source_branch}")
51
+ system ("git checkout #{destination_branch}")
52
+ system ("git pull origin #{destination_branch}")
53
+ system ("git merge #{source_branch}")
54
+ puts ("==============================")
55
+ puts ("========== STATUS ============")
56
+ puts ("==============================")
57
+ system ("git status")
58
+
59
+ remote = options[:remote]
60
+ if remote
61
+ system ("git push origin HEAD")
62
+ end
63
+ end
64
+
65
+ end
66
+
67
+ CGit.start
metadata ADDED
@@ -0,0 +1,59 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: cgit
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Kevin Wong
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-03-30 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: thor
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - '>='
18
+ - !ruby/object:Gem::Version
19
+ version: 0.19.1
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - '>='
25
+ - !ruby/object:Gem::Version
26
+ version: 0.19.1
27
+ description: Some useful git command line shortcuts
28
+ email:
29
+ executables:
30
+ - cgit
31
+ extensions: []
32
+ extra_rdoc_files: []
33
+ files:
34
+ - bin/cgit
35
+ homepage: https://github.com/kevinwl02/Custom-Git
36
+ licenses:
37
+ - MIT
38
+ metadata: {}
39
+ post_install_message:
40
+ rdoc_options: []
41
+ require_paths:
42
+ - lib
43
+ required_ruby_version: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - '>='
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ required_rubygems_version: !ruby/object:Gem::Requirement
49
+ requirements:
50
+ - - '>='
51
+ - !ruby/object:Gem::Version
52
+ version: '0'
53
+ requirements: []
54
+ rubyforge_project:
55
+ rubygems_version: 2.0.14
56
+ signing_key:
57
+ specification_version: 4
58
+ summary: Some useful git command line shortcuts
59
+ test_files: []