Giter VIP home page Giter VIP logo

gitreflow's Introduction

git-reflow – Automate your git workflow
(2015 Fukuoka Ruby Award Winner)

Git workflow powered by git-reflow Git workflow powered by git-reflow Git-Reflow Documentation

git-reflow deliver

If your workflow looks like this:

  1. Create a feature branch
  2. Write great code
  3. Create a pull request against master
  4. Get 'lgtm' through a code review
  5. Merge to master (squashed by default, but can be overridden; why we prefer squash-merge)
  6. Delete the feature branch

Reflow will make your life easier.

Reflow automatically creates pull requests, ensures the code review is approved, and merges finished branches to master with a great commit message template.

Usage Overview

Create and switch to new branch nh-branchy-branch:

    $ git reflow start nh-branchy-branch

Create a pull request for your branch against master or a custom base-branch:

    $ git reflow review

If your code is approved, merge to base-branch and delete the feature branch:

    $ git reflow deliver

Benefits

  • Enforce code reviews across your team.
  • Know that your entire team delivers code the same way.
  • Reduce the knowledge needed to deliver great code.
  • Have a commit history that's clean and actually usable.
  • Revert features with ease (if needed).
  • Work with diverse teams with less worry about different processes.
  • Stop searching for other git workflows. Reflow covers 90% of your needs without junk you'll never use.

Features

  • Automatically create pull requests to master
  • Automatically ensure that your code is reviewed before merging
  • Start with sensible commit messages by default
  • Squash merge feature branches because results are more important than details
  • Automatically clean up obsolete feature branches after a successful merge

Prerequisites

Editor When reviewing the title and body for a new pull request, or reviewing the commit message when delivering a feature, we will open a temporary file with your default editor. We will use git's chosen editor first (git config core.editor), then we try your EDITOR environment variable, and lastly we fallback on "vim". If you would like to use an editor of your choice, we recommend setting it with git's config. As an example, to use Atom as your editor for all git commands:

$ git config --global core.editor "atom --wait"

See GitHub's full article on associating text editors with Git for more information on adding this.

Getting Started

On your first install, you'll need to setup your Github credentials. These are used only to get an OAuth token that we will store in a reflow-specific git config file. We use this token so we can create pull requests from the command line.

$ gem install git_reflow

... installs gem ...

$ git reflow setup
Please enter your GitHub username: nhance
Please enter your GitHub password (we do NOT store this):

Your GitHub account was successfully setup!

This is safe to run multiple times. We don't care. We save this information in a special git configuration file (~/.gitconfig.reflow) that get's included into your global ~/.gitconfig file.

For usage with Github Enterprise, or other custom configurations, see our Advanced Usage Guide.

Starting a feature branch

git reflow start

This sets up a feature branch remotely and brings a local copy to your machine. Yeah, you can do this by hand pretty easily, so skip this command if you want. This is just a handy shortcut with no magic.

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 flag of a base-branch name (--base). If you don't pass in this parameter, then it will look up the reflow.base-branch git configuration or default to "master". The base branch name is the base branch that you want to base your feature off of. This ensures that every time you start a new base branch, it will be based off of your latest remote base.

git reflow start nh-branch-name --base 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 N.H., so all of my branches start with nh-

Refreshing your current branch based on your base branch

git reflow refresh

This command updates your feature-branch and base-branch according to the remote-location and then merges your base-branch into your feature-branch. This is just a handy command to keep your branches up to date at any point in time if someone else has committed to the base-branch or the remote.

git reflow refresh -r <remote-location> -b <base-branch>

You pass in the name of the remote to fetch from and the name of the base-branch that you would like to merge into your feature-branch. The remote-location defaults to origin and the base-branch defaults to master. This command also takes in remote and branch name as flag options.

Note: If no base-branch argument is provided, then we'll look for a reflow.base-branch git configuration and fallback to master as the default.

Reviewing your work

git reflow review

git reflow review

All of our work is reviewed by our team. This helps spread knowledge to multiple parties and keeps the quality of our code consistent.

The review step creates a pull request for the currently checked out feature branch against master. That's all you want to do most of the time. We assume you know what you're doing, so if you need something different, do it by hand.

After making commits to your branch, run review. Didn't push it up? No problem, we'll do it for you.

git reflow review -t <title> -m <message> <base-branch>

Note: -t and -m are optional, as is the base-branch argument. If no base-branch is provided, then we'll look for a reflow.base-branch git configuration and fallback to master as the default.

If you do not pass the title or message options to the review command, you will be given an editor to write your PR request commit message, similar to git commit. The first line is the title, the rest is the body.

$ git reflow review

Review your PR:
--------
Title:
rj_209_test

Body:
[lib] updates review command to address issues
--------
Submit pull request? (Y): <enter>
git fetch origin master
From github.com:meesterdude/gitreflow
 * branch            master     -> FETCH_HEAD

git push origin rj_test
Everything up-to-date

Successfully created pull request #6: rj_test
Pull Request URL: https://github.com/meesterdude/gitreflow/pull/6
Would you like to push this branch to your remote repo and cleanup your feature branch? y<enter>

We output the pull request URL so you can distribute it to your team.

How it works

Behind the scenes, this is how review works:

git fetch origin

Are we up-to-date with changes from master? If not, fail with "master has newer changes".

Then,

git push origin current-branch # Updates remote branch

Do we have pull request? If not, create it and print "Pull request created at http://pull-url/". If so, print the url for the existing request.

Checking your branch status

git reflow status

git reflow status <base-branch>

Note: If no base-branch is provided, then we'll look for a reflow.base-branch git configuration and fallback to master as the default.

Sometimes you start working on a branch and can't get back to it for a while. It happens. Use +status+ to check on the status of your work.

$ git reflow status

Here's the status of your review:
  branches:     reenhanced:nh-readme-update -> reenhanced:master
  number:       35
  reviewed by:
  url:          https://github.com/reenhanced/gitreflow/pull/35

[notice] No one has reviewed your pull request.

This gives you details on who's reviewed your pull request. If someone has participated in reviewed, but not given you an approval, this will tell you. status prevents you from having to open a browser to find out where your pull request is at. But in case you want to take a look, we give you the option to open it for you.

Delivering approved code

git-reflow deliver

git reflow deliver <base-branch>

Note: If no base-branch argument is provided, then we'll look for a reflow.base-branch git configuration and fallback to master as the default.

Also: This documentation is for the process for the github "remote" merge process via the github_api. For the bitbucket standard or github manual process (used when the user applies -f force flag to the "remote" merge via the github_api), please go to section B.

You kick butt. You've got your code reviewed and now you're ready to merge it down to master and deploy. Reflow's deliver command will take care of all of the steps for you to make this happen.

Reflow's deliver requires you to have a pull request, so you'll be protected on those mornings when the coffee isn't working yet. We built this to get in your way and make you follow the process. If you don't like it, do it by hand. You already know what you're doing.

You'll be presented with a pre-filled commit message based on the body of your pull request with references to the pull request and reviewers.

Want to clean up your feature branch afterwards? You'll be prompted after you edit your commit message if you want to clean up your feature-branch on Github. If you answer no, then your feature-branch will exist for you to clean it up later.

This is what it looks like:

$ git reflow deliver
Here's the status of your review:
    branches:     simonzhu24:test1234 -> simonzhu24:master
    number:       51
    reviewed by:  @codenamev
    url:          https://github.com/simonzhu24/test/pull/51

This is the current status of your Pull Request. Are you sure you want to deliver? yes

Merging pull request #51: 'last commit message', from 'simonzhu24:test1234' into 'simonzhu24:master'
git checkout master
Switched to branch 'master'
Your branch is ahead of 'origin/master' by 1 commit.
  (use "git push" to publish your local commits)

[success] Pull Request successfully merged.
Would you like to cleanup your feature branch? yes
git pull origin master
remote: Counting objects: 1, done.
remote: Total 1 (delta 0), reused 0 (delta 0), pack-reused 0
Unpacking objects: 100% (1/1), done.
From https://github.com/simonzhu24/test
 * branch            master     -> FETCH_HEAD
   0d8f5e0..f853efa  master     -> origin/master
Updating 0b6782f..f853efa
Fast-forward
 README.md | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

git push origin :test1234
To https://github.com/simonzhu24/test.git
 - [deleted]         test1234

git branch -D test1234
Deleted branch test1234 (was e130c7a).
Nice job buddy.

How it works

This is what we do behind the scenes when you do deliver

  • Does a pull request exist?
    • If not, stop here. You need to run review.
  • Has the review been completed? Did we get an approval from everyone who's participated?
    • If not, show a list of authors that need to approve.
  • If the review is done, it's time to merge. Here's what happens:
    1. First, we use the github_api gem to merge the pull request (see here for how we do this).

      Notice: we will do a squash-merge by default. You can customize the merge method for your project.

    2. Next, we prompt you if you want to cleanup: Would you like cleanup your feature branch?
    • If yes, then we'll update the base-branch and delete the feature-branch

      git pull origin <base-branch>
      git push origin :<feature-branch>
      git branch -D <feature-branch>
      
    • If 'no', then just stop here. The user can clean up his branch locally.

This is what the process looks like for Bitbucket or if you force deliver (git reflow deliver -f):
  From github.com:reenhanced/gitreflow
  * branch            master     -> FETCH_HEAD
  Merging pull request #36: 'Enforce at least one LGTM before delivery', from 'reenhanced:nh-fail-without-lgtm' into 'reenhanced:master'
  Already up-to-date.
  Switched to branch 'nh-fail-without-lgtm'
  Switched to branch 'master'
  Updating c2ec1b1..f90e111
   Squash commit -- not updating HEAD
   lib/git_reflow.rb | 71 +++++++++++++++++++++++++++----------------------------
   1 file changed, 35 insertions(+), 36 deletions(-)
  [master d1b4dd5] Enforces LGTM before deliver, even with no comments.
   1 file changed, 35 insertions(+), 36 deletions(-)
  Merge complete!
  Would you like to push this branch to your remote repo and cleanup your feature branch? y
  Counting objects: 7, done.
  Delta compression using up to 16 threads.
  Compressing objects: 100% (4/4), done.
  Writing objects: 100% (4/4), 1.38 KiB, done.
  Total 4 (delta 2), reused 0 (delta 0)
  To [email protected]:reenhanced/gitreflow.git
     c2ec1b1..d1b4dd5  master -> master

  To [email protected]:reenhanced/gitreflow.git
   - [deleted]         nh-fail-without-lgtm

  Deleted branch nh-fail-without-lgtm (was f90e111).

This is what the default commit message looks like:

  Enforces LGTM before deliver, even with no comments.
  Removes the need to review the pull request yourself if you make a
  comment.

  Better error message if setup fails.

  Bug fixes.

  Closes #36

  LGTM given by: @codenamev

  Squashed commit of the following:

  commit f90e111
  Author: Nicholas Hance <[email protected]>
  Date:   Thu Jul 11 15:33:29 2013 -0400
  ...

If the review is done, it's time to merge. Here's what happens:

  1. First, update our local master so we don't get conflicts
git checkout master
git pull origin master
  1. Next, merge our feature branch (in our case squash-merge)
git merge --squash nh-branch-name
  1. Now, we'll apply a little magic so we have a great commit message by default. Your editor will open and you'll see a nice default for your commit message based on the pull request body.
git commit

Note: We use .git/COMMIT_EDITMSG by default for populating this. See the Full List of Configuration for how you can change this.

  1. Once you've saved the commit, we'll make sure you want to continue.
Merge complete!
Would you like to push this branch to your remote repo and cleanup your feature branch?
  • If 'yes', then we'll push to base-branch(default: master) and delete the feature-branch
    git pull origin master
    git push origin master
    git push origin :nh-branch-name
    git branch -D nh-branch-name
    
  • If 'no', then just stop here. The user can reset his local base-branch. And we're done!

Guiding Principles

  • Your workflow should resemble the following:

    git reflow workflow

  • You should already know what you're doing. We assume you know how to use git.

  • The master branch is your codebase. You don't need multiple branches for code you want to use.

  • master should remain stable at all times. The entire team depends on it.

  • No direct commits to master. All work happens in feature branches. From a single commit to hundreds.

  • All feature branches are reviewed via pull requests.

  • Looks Good To Me. All feature branches require approval. We check both Github's Approvals, and look for the string 'LGTM' in a comment on the pull request to know it's ready to merge.

  • If you make a new commit in your branch, you require another review.

  • Depending on your git config constants.minimumApprovals setting, which we specify in your ~/.gitconfig.reflow (created upon reflow setup), you can have the following:

minimumApprovals Applied Restrictions
"" All participants in a pull request must approve the pull request.
"0" 0 approvals required for you to merge PR.
"1" You need a minimum of 1 LGTM and the last comment on your PR must be an LGTM.
"2" You need a minimum of 2 LGTM and the last comment on your PR must be an LGTM.
  • Once approved, your feature-branch is merged to your base-branch. This makes the history of the base-branch extremely clean and easy to follow.

  • git blame becomes your friend. You'll know who to blame and can see the full context of changes. Squash commits to base-branch mean every commit represents the whole feature, not a "typo fix".

Configuration

In order to streamline delivery you can set the following git config to:

  1. always clean up the remote feature branch after the PR is merged git config --global --add "reflow.always-cleanup-remote" "true"
  2. always clean up the local feature branch after the PR is merged git config --global --add "reflow.always-cleanup-local" "true"
  3. always deliver without further prompt git config --global --add "reflow.always-deliver" "true"

See our Advanced Usage for more ways you can customize your workflow.

Customization

Git-reflow's default process isn't meant to fit every team, which is why we've introduced Custom Workflows. With a custom workflow, you can:

  • Add hooks to be run before, or after any command
  • Use one of our pre-configured workflows as a basis for your own
  • Override any of the default commands
  • Create new commands

Contributing

Pull requests are welcome. Please fork and submit. We use this tool every single day and as long as what you want to add doesn't change our workflow, we are happy to accept your updates. Feel free to add your Github username to the list below.

Authors:

  • @codenamev
  • @armyofgnomes
  • @nhance

Built by Reenhanced: http://www.reenhanced.com

Looking for a capable team for your project? Get in touch. We're looking to grow.

Licensed using the MIT license. Do whatever you like with this, but don't blame us if it breaks anything. You're a professional, and you're responsible for the tools you use.

gitreflow's People

Contributors

codenamev avatar dreid avatar francois avatar hsbt avatar johanoskarsson avatar marten avatar meesterdude avatar nhance avatar pboling avatar puzzleduck avatar sethladd avatar shalmezad avatar shirshendu avatar simonzhu24 avatar squaresurf avatar timraasveld avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

gitreflow's Issues

Review command race condition

Sometimes the pull request trying to get created for a branch that doesn't exist yet. Need to wait for the initial push before we can create the pull request.

Support for non-master branch

The README refers to master branch explicitly and a quick search of the source code shows it mostly hardcoded. What would be the best way to support a permanently configured alternative base, e.g. 'develop'? e.g. supporting an environment variable GITREFLOW_BASE or something like that.

gitreflow doesn't seem to work well with BitBucket's pull request

So, if we use it, BitBucket's pull request won't be closed because gitreflow merge the pull request manually into master. After master has the new change, the pull request will become empty.

I think the workflow can be changed to:

Assuming we want to merge the branch A into master.

  1. Squash all commits in A into a single commit and force push. The pull request on Bitbucket will reflect this change.
  2. Use BitBucket API to merge (instead of merging manually)

In this way, we won't have an empty pull request.

I understand this might be a lot of work though.

(This workflow works for Github as well.)

Option to silence the offer to open the PR in my browser?

In order to make the workflow faster, what do you think about not prompting to open the PR at the end of git reflow review ?

git reflow review --help doesn't list an option to turn off that offer.

Many terminals will let a user click a URL, so perhaps we could just print out the PR URL, and if the user wants to visit there, they can click it.

Why is squashed merging your preferred workflow?

I'm wondering why you chose to adopt this workflow. Do you really want to get rid of the individual commits, or do you only like the simplified history? We're looking at using this tool because it closely matches our current workflow, with the biggest difference being the squashing.

It's probably a lack of understanding on my part, but I'm wondering what advantage I'm missing, since the cleaner history can also be gotten with git log --first-parent and seeing everything that was merged in a specific commit can be achieved with git show -m SHA1 (provided you do --no-ff merge commits).

This might also be something to add to the README or Wiki, since I can't be the only one wondering this.

Git reflow setup undefined method `body`

I have stumbled into this error suddenly. Can anyone help what could be the problem.

error: undefined method body' for #<ArgumentError: wrong number of arguments (2 for 1)>`

GIT_REFLOW_PR_MSG: Permission denied

After running git reflow review on my first branch created by reflow, I saw this error:

~/Code/dartdoc[sl-hide-exceptions] $ git reflow review
sh: /Users/sethladd/Code/dartdoc/.git/GIT_REFLOW_PR_MSG: Permission denied

It looks like I'm not able to edit my PR message, and maybe this error is why?

Command to edit default commit format

During the setup there was no option to specify a default commit format. I apologise in advance if I overlooked such a feature.

In my case I want to remove all the squashed commit information from the default commit text, since this info is not relevant in any case and just takes up space.

Error when running git reflow review

Just install the reflow gem and went through the setup. When I ran git reflow review on the branch I was working on I got the following message:
error: undefined method 'shift' for "git rev-parse --show-toplevel":String
error: undefined method 'strip' for 1:Fixnum

Did this on my PC at work so I'm not sure if that is being goofy. I wasn't able to get resnet running locally on that machine but did on my Mac at home. Cloned a copy of the work I had done at home to my work machine and thought I could push up the changes for review using reflow.

Let me know if you need more info.

Thanks,

Mike Prince

rescue/allow retry on review submit

sometimes, when you submit a PR to github, it errors. we should catch this, and ask the user if they want to retry; usually a retry seems to work. maybe even retry a few times ourselves.

Setup does not work when 2-factor authentication is enabled

Running setup when 2-factor is enabled simply tells you "Invalid username or password". If you dig deeper and comment out the rescue statement, you see the actual error which is:

error: POST https://api.github.com/authorizations: 401 Must specify two-factor authentication OTP code.

Github's guide here has some pointers on how to deal with this.

add changelog support

I usually am verbose about my PR messages; it's the place i do my brain dump of what i was thinking, issues I ran into, and so on. Sometimes I write nice commit messages that would work well in a changelog; others are just noise.

ideally, we'd set a flag on review command that grabs the commits we wrote and formats them in a change log for us in the PR, and presents in editor for update

Might be a good idea to flag commits when creating them to be changelog specifically; or, maybe just delete ones that are noise when submitting the PR.

However, changes can occur after a PR is submitted. So we'll want to think about what we do there; perhaps offer a direct way to regenerate the changelog, so we can at least copy in anything new.

a starting point: git log --pretty=format:"%B" --first-parent --no-merges master..branchname

Print all git commands

Let's be verbose. We want to print every command right before we run it so there are no surprises, and so we never forget the right way to do things.

Add integration with Gitlab

I asked Valentino about this, and his reply (a month ago now) was:

We've recently abstracted much of the git server interaction into a generic interface so we could work on a BitBucket integration (which is 90% there). We don't currently have plans to integrate with Gitlab, but would happily merge it if you'd like to tackle it. Take a look at our github implementation as a reference. It's in the same directory as the base.rb

If you decide to take on the challenge feel free to ask away with any questions and I'll help where I can. Otherwise open an issue for it as a feature and we'll let the community decide on it.

Unfortunately we probably won't have scope to work on this ourselves where I'm currently working so opening this issue as a feature

Thanks,
Peter

Add support for open-source workflows

This feature needs to account for both the external contributor (the one doing the forking) and the members of the project (that do the merging of the PR).

Starting a new task from an opensource project (external contributor):

git reflow start opensource-user/opensource-project

  1. Create fork if one doesn't already exist for the base repo
  2. Create feature branch as usual
  3. git reflow review would squash commits and then submit a cross-fork pull-request
  4. git reflow deliver would check for merge of PR on base-repo, and then cleanup the local repo's feature branch as usual

Delivering (project member merging PR)

When merging down pull requests on opensource projects, it currently loses track of the original author since we're squash-merging the commits. We'll need some sort of way to retain the attribution to the original author (maybe using --author for the final commit?)

  1. git reflow deliver external_contributor_username/project_name (doing this will perform the following)
  2. git remote add remote_user_of_pull
  3. git fetch remote_user_of_pull
  4. git checkout master
  5. git pull origin master
  6. git merge --squash remote_user_of_pull/branch_of_pull
  7. git commit --author "Author of PULL <[email protected]>"
  8. git push origin master
  9. Ask to cleanup remote and if Y: git remote rm remote_user_of_pull

We'll want to implement this as a Custom Workflow and added to the other workflows here.

No help from git reflow --help

Hi,

What do you think about printing options from a git reflow --help ?

~/Code/dartdoc/test_package[sl-dual-nav] $ git reflow --help
No manual entry for git-reflow

reflow needs an lgtm from myself

Would it make sense for reflow not to require an lgtm from myself, if I've commented on the PR? Right now, I need to type lgtm into a comment on my PR before I can deliver a branch with reflow.

Syntax for `review`

I'd like to assign a title/message from the command line for review.

Here's the syntax that seems immediately intuitive:

git reflow review -t "This is the title" -m "Here's a message"

Getting a 'error: POST https://api.github.com/authorizations: 422' when entering correct user/password

I'm not using 2-factor auth.

After getting frustrated of all the 'Invalid username or password"' and some attempts of changing my password, I commented out rescue StandardError => e in git_reflow.rb to see what's wrong:

Please enter your GitHub username: steipete
Please enter your GitHub password (we do NOT store this): 
error: POST https://api.github.com/authorizations: 422 

My credentials must match, when I enter them wrongly I get

Please enter your GitHub username: steipete
Please enter your GitHub password (we do NOT store this): 
error: POST https://api.github.com/authorizations: 401 Bad credentials

GitHub says "Sending invalid fields will result in a 422 Unprocessable Entity response.".
What am I doing wrong here? Version 0.3.4 here (installed via gem install reflow)

Default PR title from branch name rather than last commit

Or better yet enable user to edit title on command line before creating PR during deliver. We have Slack notifications setup for PRs and having all these random PR titles pop up is confusing/annoying, especially for non-devs on the team who keep up with app progress.

404 error on all PR functions

Getting a 404 error when git reflow tries to do anything on a pull request. review fails, and even if I make a PR manually for the branch delver and status also fail.

Tried to re-run git reflow setup but it just tells me that

Your GitHub account was already setup with:   
    User Name:   
    Endpoint: https://api.github.com  

as does git reflow setup -l

Example of one of the errors (on review):
Error: #<Github::Error::NotFound: GET https://api.github.com/repos/github.com/sproutli/pulls?access_token=32162b54b3c8501f6b260e37b8a7f3d88cfc3d53%0A&base=master&head=github.com%3Aselectize&state=open: 404 Not Found>

My collaborator is getting the same error.

Introduce the idea of "Workflows" to customize steps

Workflows

Premise: Define your workflow in a config file that would plug-in to git-reflow. Like the way oh-my-zsh works with plugins combined with the idea of how Capistrano handles callbacks.

So you could define a file that has a bunch of before/after calls that can target the core workflow (the basic reflow commands) as well as target other workflows.

Core Workflow:

# Core workflow
commands :setup, :start, :review, :status, :stage, :deliver

start(branch_name) do
  run_command_with_label 'git pull origin', { GitReflow.current_branch }
  run_command_with_label 'git push origin', { "#{GitReflow.current_branch}:refs/heads/#{branch_name}" }
  run_command_with_label 'git checkout --track -b', { "#{branch_name} origin/#{branch_name}" }
end

# ... other commands would go after this

Customized Workflow

# would setup all default commands from above
require 'git_reflow/workflows/core' 

replace(:start) do
  # ... commands to run instead of git-reflow core
end

before(:start) do
  # ... do something else here
end

after(:start) do
  # ... do something else here
end

git reflow setup not working

$ git reflow setup
Available remote Git Server services::

  1. GitHub
  2. BitBucket (team-owned repos only)
    Which service would you like to use for this project? 1
    Your GitHub account was already setup with:
    User Name:
    Endpoint: https://api.github.com

Let me know if you need more information.

Github pre-receive hook to ensure review is not skipped

I'd like to enforce that the reflow review process is followed by disallowing merging to master without reviews (unless the user forces it explicitly during an emergency).

Would this be a feature that could live in reflow?

Store OAuth token somewhere else?

I have my dotfiles in a public git repository. ~/.git/config is one of those files. In the current way of storing the OAuth token, I can't add the config line to the gitignore. What is the best way to make sure I never commit this?

I'd be happy to add something that can store the token in a different file, and maybe then put the file location in the git config? Is this something you'd merge in?

message below the fold in review

Ideally, when I am presented the editor, this is what i'll see

rj_201_login_fix

this fixes 209 and should be good to go!

--end--

So, you're creating a PR? did you...

1. Write tests?
2. Add Documentation?
3. Merge in master?

Where, anything after --end-- is sourced from a file that the project defines. So, projects can use reflow and define their own checklist to display (or whatever else) in the editor, as you create the PR.

we then just split on --end-- and throw away anything after it, when creating the PR.

However, one snag is either we force a specific file name in the app root, or have to have some kind of project-level config to define it.

bad URI on git reflow status

When executing git reflow status I get

error: bad URI(is not URI?): https://api.github.com

commands which do not use GitHub API (eg. start) work as expected.

Any ideas? Thanks in advance.

Setup fails

Don't know if it's a Ruby 2 / OSX Mavericks issue, but the setup fails with

git reflow setup
/Users/ea/.rbenv/versions/2.0.0-p247/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in `require': cannot load such file -- json/pure (LoadError)
    from /Users/ea/.rbenv/versions/2.0.0-p247/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in `require'
    from /Users/ea/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/git_reflow-0.3.3/lib/git_reflow.rb:6:in `<top (required)>'
    from /Users/ea/.rbenv/versions/2.0.0-p247/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in `require'
    from /Users/ea/.rbenv/versions/2.0.0-p247/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in `require'
    from /Users/ea/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/git_reflow-0.3.3/bin/git-reflow:16:in `<top (required)>'
    from /Users/ea/.rbenv/versions/2.0.0-p247/bin/git-reflow:23:in `load'
    from /Users/ea/.rbenv/versions/2.0.0-p247/bin/git-reflow:23:in `<main>'

Github Enterprise Compatibility

I couldn't find a way to use this against a github enterprise instance as it always attempts to connect to github.com / api.github.com

This is possible according to the documentation at http://peter-murach.github.io/github/

github = Github.new do |config|
  config.endpoint    = 'https://github.company.com/api/v3'
  config.site        = 'https://github.company.com'
end

command for merging updates from base branch

As a policy, we ask developers to merge updates from the base branch (e.g. master) prior to submitting or resubmitting a PR for review. Due to merge squashing, it won't matter how many messy merge commits come, so this is good practice for a project where people are committing things that don't cause merge conflict but could still cause problems. A reflow command for this would be good.

deliver halted because lgtm not detected, but lgtm exists

screen shot 2015-07-29 at 3 25 45 pm

~/Code/dartdoc/test_package[sl-remove-overlay-on-resize] $ git reflow deliver
git fetch origin master
From github.com:dart-lang/dartdoc
 * branch            master     -> FETCH_HEAD

git checkout sl-remove-overlay-on-resize
Already on 'sl-remove-overlay-on-resize'
Your branch is up-to-date with 'origin/sl-remove-overlay-on-resize'.
git pull origin sl-remove-overlay-on-resize
From github.com:dart-lang/dartdoc
 * branch            sl-remove-overlay-on-resize -> FETCH_HEAD
Already up-to-date.
git checkout sl-remove-overlay-on-resize
Already on 'sl-remove-overlay-on-resize'
Your branch is up-to-date with 'origin/sl-remove-overlay-on-resize'.
[deliver halted] You still need a LGTM from: devoncarew

Notice how devoncarew gave an lgtm.

Any ideas why reflow won't deliver the feature?

tmp_squash_msg can be improved

tmp_squash_msh seems to be hanging around if we use git reflow in other directories than root. This is due to this part of code.

    def append_to_squashed_commit_message(message = '')
      run "echo \"#{message}\" | cat - .git/SQUASH_MSG > ./tmp_squash_msg"
      run 'mv ./tmp_squash_msg .git/SQUASH_MSG'
    end

If we are not the the root directory, the relative ./git won't exist

We can change to something like:

    def append_to_squashed_commit_message(message = '')
     git_root_dir = `echo $(git rev-parse --show-toplevel)`
      run "echo \"#{message}\" | cat - #{git_root_dir}/.git/SQUASH_MSG > #{git_root_dir}/tmp_squash_msg"
      run 'mv #{git_root_dir}/tmp_squash_msg #{git_root_dir}/.git/SQUASH_MSG'
    end

Error: #<NameError: wrong constant name >

In my test repo with git_reflow (0.6.1) on osx 10.10.4:

marburg:git-review johan$ git reflow start testtest
From github.com:johanoskarsson/git-review
 * branch            master     -> FETCH_HEAD
Total 0 (delta 0), reused 0 (delta 0)
To [email protected]:johanoskarsson/git-review.git
 * [new branch]      master -> testtest
Switched to a new branch 'testtest'

<add some test commits>

marburg:git-review johan$  git reflow review
sh: /Users/johan/Dev/git-review/.git/GIT_REFLOW_PR_MSG: Permission denied

Review your PR:
--------
Title:
testtest

Body:

--------
Submit pull request? (Y)

git fetch origin master
From github.com:johanoskarsson/git-review
 * branch            master     -> FETCH_HEAD

git push origin testtest
Counting objects: 3, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 295 bytes | 0 bytes/s, done.
Total 3 (delta 0), reused 0 (delta 0)
To [email protected]:johanoskarsson/git-review.git
   9271ae2..4fcfb32  testtest -> testtest


Error: #<NameError: wrong constant name >

Show an error message when trying to use the `http` url

Reflow depends on us having the ssh keys in place and using that as the authentication method for github. Not everyone will get their repo setup that way, so we need to cowardly refuse to work on a repo when they haven't used the ssh url

add "Created With Reflow"

At the bottom of every PR, we can add the text "Created With Reflow" where reflow is a link to the project. Similar to "sent from my iphone"

This would need to be appended automatically; but for the most part appears at the bottom of the editor and can be easily nuked.

Perhaps a personal setting can decide to disable this feature for good, should the user be bothered by it.

`git reflow status` does not open in browser when answering 'y'

[notice] No one has reviewed your pull request.
Would you like to open it in your browser? y
Usage: open [-e] [-t] [-f] [-W] [-R] [-n] [-g] [-h] [-b <bundle identifier>] [-a <application>] [filenames] [--args arguments]
Help: Open opens files from a shell.
      By default, opens each file using the default application for that file.
      If the file is in the form of a URL, the file will be opened as a URL.
Options:
      -a                Opens with the specified application.
      -b                Opens with the specified application bundle identifier.
      -e                Opens with TextEdit.
      -t                Opens with default text editor.
      -f                Reads input from standard input and opens with TextEdit.
      -F  --fresh       Launches the app fresh, that is, without restoring windows. Saved persistent state is lost, excluding Untitled documents.
      -R, --reveal      Selects in the Finder instead of opening.
      -W, --wait-apps   Blocks until the used applications are closed (even if they were already running).
          --args        All remaining arguments are passed in argv to the application's main() function instead of opened.
      -n, --new         Open a new instance of the application even if one is already running.
      -j, --hide        Launches the app hidden.
      -g, --background  Does not bring the application to the foreground.
      -h, --header      Searches header file locations for headers matching the given filenames, and opens them.

License missing from gemspec

Some companies will only use gems with a certain license.
The canonical and easy way to check is via the gemspec
via e.g.

spec.license = 'MIT'
# or
spec.licenses = ['MIT', 'GPL-2']

There is even a License Finder to help companies ensure all gems they use
meet their licensing needs. This tool depends on license information being available in the gemspec.
Including a license in your gemspec is a good practice, in any case.

How did I find you?

I'm using a script to collect stats on gems, originally looking for download data, but decided to collect licenses too,
and make issues for missing ones as a public service :)
https://gist.github.com/bf4/5952053#file-license_issue-rb-L13 So far it's going pretty well

f has already been specified as a switch in the command deliver (ArgumentError)

Just installed git reflow with

gem install reflow

on OS X Mavericks with rbenv 0.4.0 and Ruby 2.1.0-p0 (also tried with 2.0.0-p353). I keep getting the following error:

~/code/project » git reflow                                                                                                                              
/usr/local/opt/rbenv/versions/2.0.0-p353/lib/ruby/gems/2.0.0/gems/gli-2.8.1/lib/gli/dsl.rb:203:in `verify_unused_in_option': f has already been specified as a switch in the command deliver (ArgumentError)
from /usr/local/opt/rbenv/versions/2.0.0-p353/lib/ruby/gems/2.0.0/gems/gli-2.8.1/lib/gli/dsl.rb:197:in `block in verify_unused'
from /usr/local/opt/rbenv/versions/2.0.0-p353/lib/ruby/gems/2.0.0/gems/gli-2.8.1/lib/gli/dsl.rb:195:in `each'
from /usr/local/opt/rbenv/versions/2.0.0-p353/lib/ruby/gems/2.0.0/gems/gli-2.8.1/lib/gli/dsl.rb:195:in `verify_unused'
from /usr/local/opt/rbenv/versions/2.0.0-p353/lib/ruby/gems/2.0.0/gems/gli-2.8.1/lib/gli/dsl.rb:97:in `switch'
from /usr/local/opt/rbenv/versions/2.0.0-p353/lib/ruby/gems/2.0.0/gems/gli-2.8.1/lib/gli/command_support.rb:73:in `switch'
from /usr/local/Cellar/rbenv/0.4.0/versions/2.0.0-p353/lib/ruby/gems/2.0.0/gems/git_reflow-0.3.4/lib/git_reflow/commands/deliver.rb:6:in `block in <top (required)>'
from /usr/local/opt/rbenv/versions/2.0.0-p353/lib/ruby/gems/2.0.0/gems/gli-2.8.1/lib/gli/dsl.rb:177:in `command'
from /usr/local/Cellar/rbenv/0.4.0/versions/2.0.0-p353/lib/ruby/gems/2.0.0/gems/git_reflow-0.3.4/lib/git_reflow/commands/deliver.rb:4:in `<top (required)>'
from /usr/local/opt/rbenv/versions/2.0.0-p353/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:114:in `require'
from /usr/local/opt/rbenv/versions/2.0.0-p353/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:114:in `require'
from /usr/local/opt/rbenv/versions/2.0.0-p353/lib/ruby/gems/2.0.0/gems/gli-2.8.1/lib/gli/app.rb:280:in `block in load_commands'
from /usr/local/opt/rbenv/versions/2.0.0-p353/lib/ruby/gems/2.0.0/gems/gli-2.8.1/lib/gli/app.rb:277:in `each'
from /usr/local/opt/rbenv/versions/2.0.0-p353/lib/ruby/gems/2.0.0/gems/gli-2.8.1/lib/gli/app.rb:277:in `load_commands'
from /usr/local/opt/rbenv/versions/2.0.0-p353/lib/ruby/gems/2.0.0/gems/gli-2.8.1/lib/gli/app.rb:38:in `block in commands_from'
from /usr/local/opt/rbenv/versions/2.0.0-p353/lib/ruby/gems/2.0.0/gems/gli-2.8.1/lib/gli/app.rb:36:in `each'
from /usr/local/opt/rbenv/versions/2.0.0-p353/lib/ruby/gems/2.0.0/gems/gli-2.8.1/lib/gli/app.rb:36:in `commands_from'
from /usr/local/opt/rbenv/versions/2.0.0-p353/lib/ruby/gems/2.0.0/gems/git_reflow-0.3.4/bin/git-reflow:24:in `<top (required)>'
from /usr/local/opt/rbenv/versions/2.0.0-p353/bin/git-reflow:23:in `load'
from /usr/local/opt/rbenv/versions/2.0.0-p353/bin/git-reflow:23:in `<main>'

I chased Google to find the answer, but got nothing. Any ideas?

P.S. This is probably something GLI-related?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.