create git commands
This commit is contained in:
@@ -12,7 +12,7 @@ module Feature
|
||||
end
|
||||
|
||||
def execute
|
||||
run_cmd "git branch"
|
||||
git_show_branches
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -22,15 +22,15 @@ module Feature
|
||||
|
||||
error "invalid feature branch: #{feature_branch}" if standard_branches.include? feature_branch
|
||||
|
||||
run_cmd "git checkout #{standard_branch}"
|
||||
git_checkout standard_branch
|
||||
|
||||
if remote_branch(feature_branch) != ""
|
||||
run_cmd "git push origin :#{feature_branch}"
|
||||
git_remote_branch_delete feature_branch
|
||||
end
|
||||
|
||||
run_cmd "git branch -D #{feature_branch}"
|
||||
git_local_branch_delete feature_branch
|
||||
|
||||
run_cmd "git remote prune origin"
|
||||
git_prune
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -27,11 +27,11 @@ module Feature
|
||||
|
||||
error "invalid branch: #{merge_to_branch}" unless standard_branches.include? merge_to_branch
|
||||
|
||||
run_cmd "git checkout #{merge_to_branch}"
|
||||
run_cmd "git pull origin #{merge_to_branch}"
|
||||
run_cmd "git merge #{feature_branch}"
|
||||
run_cmd "git push origin #{merge_to_branch}"
|
||||
run_cmd "git checkout #{feature_branch}"
|
||||
git_checkout merge_to_branch
|
||||
git_pull merge_to_branch
|
||||
git_merge feature_branch
|
||||
git_push merge_to_branch
|
||||
git_checkout feature_branch
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -24,16 +24,16 @@ module Feature
|
||||
error "USAGE: feature rebase" unless standard_branch
|
||||
error "invalid feature branch: #{feature_branch}" if standard_branches.include? feature_branch
|
||||
|
||||
run_cmd "git checkout #{standard_branch}"
|
||||
run_cmd "git pull origin #{standard_branch}"
|
||||
run_cmd "git checkout #{feature_branch}"
|
||||
run_cmd "git rebase #{standard_branch}"
|
||||
git_checkout standard_branch
|
||||
git_pull standard_branch
|
||||
git_checkout feature_branch
|
||||
git_rebase standard_branch
|
||||
|
||||
if remote_branch != ""
|
||||
run_cmd "git push origin :#{feature_branch}"
|
||||
git_remote_branch_delete feature_branch
|
||||
end
|
||||
|
||||
run_cmd "git push origin #{feature_branch}"
|
||||
git_push feature_branch
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -21,11 +21,11 @@ module Feature
|
||||
error "invalid base branch: #{current_branch}" unless standard_branches.include? current_branch
|
||||
error "invalid feature branch: #{featureh}" if standard_branches.include? feature
|
||||
|
||||
run_cmd "git pull origin #{current_branch}"
|
||||
git_pull current_branch
|
||||
|
||||
run_cmd "git checkout -b #{feature_branch}"
|
||||
git_local_branch_create feature_branch
|
||||
|
||||
run_cmd "git push origin #{feature_branch}"
|
||||
git_push feature_branch
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -18,6 +18,46 @@ module Shared
|
||||
puts
|
||||
exit
|
||||
end
|
||||
|
||||
def git_show_branches
|
||||
run_cmd "git branch"
|
||||
end
|
||||
|
||||
def git_checkout ( branch )
|
||||
run_cmd "git checkout #{branch}"
|
||||
end
|
||||
|
||||
def git_remote_branch_delete ( branch )
|
||||
run_cmd "git push origin :#{branch}"
|
||||
end
|
||||
|
||||
def git_local_branch_delete ( branch )
|
||||
run_cmd "git branch -d #{branch}"
|
||||
end
|
||||
|
||||
def git_prune
|
||||
run_cmd "git remote prune origin"
|
||||
end
|
||||
|
||||
def git_pull (branch)
|
||||
run_cmd "git pull origin #{branch}"
|
||||
end
|
||||
|
||||
def git_merge (branch)
|
||||
run_cmd "git merge #{branch}"
|
||||
end
|
||||
|
||||
def git_push (branch)
|
||||
run_cmd "git push origin #{branch}"
|
||||
end
|
||||
|
||||
def git_rebase (branch)
|
||||
run_cmd "git rebase #{branch}"
|
||||
end
|
||||
|
||||
def git_local_branch_create (branch)
|
||||
run_cmd "git checkout -b #{branch}"
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user