Last active
November 9, 2018 21:30
-
-
Save codenamev/e74b730fcedaa53df8ae8532d5a4b125 to your computer and use it in GitHub Desktop.
Custom git-reflow Workflow
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Use a pre-defined workflow | |
use "FlatMergeWorkflow" | |
# Do something before the `start` command | |
before :start do | |
say "Booya! Started this bad girl." | |
end | |
# Do something after the `deliver` command | |
after :deliver do | |
run "say 'Well done!'" | |
end | |
# Override the `start` command to auto-name feature branches | |
command :start, arguments: { feature_branch: nil }, flags: { base: 'dev' }, switches: { loud: false } do |**params| | |
base_branch = params[:base] | |
feature_branch = params[:feature_branch] || "feature-#{Time.now.strftime("%Y-%m-%d")}" | |
run_command_with_label "git checkout #{base_branch}" | |
run_command_with_label "git pull origin #{base_branch}" | |
run_command_with_label "git push origin #{base_branch}:refs/heads/#{feature_branch}" | |
run_command_with_label "git checkout --track -b #{feature_branch} origin/#{feature_branch}" | |
end | |
command_help( | |
:start, | |
summary: "start a feature branch", | |
arguments: { | |
feature_branch: "the branch to start your work on" | |
}, | |
flags: { | |
base: "the branch you want to branch off of, and merge into" | |
}, | |
switches: { | |
loud: "whether or not you want to see output for this" | |
}, | |
description: "check out a new branch from the latest <base-branch> and setup remote tracking" | |
) | |
# Create a new command | |
command :boom do | |
GitReflow.say "Boom." | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment