Skip to content

Commit

Permalink
[Issue reenhanced#66] Always have reflow start create a branch from m…
Browse files Browse the repository at this point in the history
…aster
  • Loading branch information
simonzhu24 committed Apr 28, 2016
1 parent 5110d04 commit 4998ffa
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 5 deletions.
7 changes: 7 additions & 0 deletions README.rdoc
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,13 @@ This sets up a feature branch remotely and brings a local copy to your machine.

$ git reflow start nh-branch-name

"Git Reflow Start" takes in the name of the new branch name that you want to create your feature on.
In addition, it takes in an optional parameter of a base branch name. If you don't pass in this parameter, then it defaults to "master".
The base branch name is the base branch that you want to base your feature off of.
This ensures that everytime you start a new base branch, it will be based off of your latest remote base.

$ git reflow start nh-branch-name base-branch-name

[PROTIP] Use your initials at the beginning of each branch so your team knows
who is responsible for each. My initials are 'NH', so all of my branches start with +nh-+

Expand Down
20 changes: 15 additions & 5 deletions lib/git_reflow/commands/start.rb
Original file line number Diff line number Diff line change
@@ -1,17 +1,27 @@
desc 'Start will create a new feature branch and setup remote tracking'
long_desc <<LONGTIME
Performs the following:\n
\t$ git pull origin <current_branch>\n
\t$ git push origin <current_branch>:refs/heads/[new_feature_branch]\n
\t$ git checkout <base_branch>\n
\t$ git pull origin <base_branch>\n
\t$ git push origin <base_branch>:refs/heads/[new_feature_branch]\n
\t$ git checkout --track -b [new_feature_branch] origin/[new_feature_branch]\n
LONGTIME
arg_name '[new-feature-branch-name] - name of the new feature branch'
arg_name '[new-feature-branch-name] - name of the new feature branch, [base-branch-name] - name of the base branch you want to start off of'
command :start do |c|
c.action do |global_options, options, args|
if args.empty?
raise "usage: git-reflow start [new-branch-name]"
raise "usage: git-reflow start [new-branch-name] [base-branch-name]"
else
`git pull origin #{GitReflow.current_branch}`
# base_branch is the branch that you want to base your feature branch off of
# This command allows you to 'git reflow start' off your base branch
case args.length
when 2
base_branch = args[1]
when 1
base_branch = "master"
end
`git checkout #{base_branch}`
`git pull origin #{base_branch}`
`git push origin #{GitReflow.current_branch}:refs/heads/#{args[0]}`
`git checkout --track -b #{args[0]} origin/#{args[0]}`
end
Expand Down

0 comments on commit 4998ffa

Please sign in to comment.