Hub: Default Config

Created on 24 Jul 2015  路  15Comments  路  Source: github/hub

I see in your docs that you have this example

git pull-request -F prepared-message.md

This is an awesome feature but it would be really nice if we could have something like a .hubconfig file that could specify something like the following.

{
    "pull-request": {
        "F": "prepared-message.md"
    }
}

or maybe like this which is a little more clean

{
    "pull-request.F": "prepared-message.md"
}

Any reasons that this would be undesirable? If this seems like a good idea to others I would love to write a PR for it.

config feature

Most helpful comment

Any progress on this? I'd like to set the default to create private repos for certain accounts.

All 15 comments

We would probably add new configuration options to existing ~/.config/hub file in YAML format.

But configuration details aside, what would this do? Apply a prepared-message.md every time you invoke hub pull-request in any project? Which directory is prepared-message.md looked up in? What if preparated-message.md doesn't exist? Please explain your feature idea.

So my thought is that this would be a per project file not per user so putting it in a home directory doesn't make a ton of sense to me. All this file would do is if the command is not set from the cli then it would be applied. So if -F was applied at the CLI it would be ignored if it was not applied then it would look for prepared-message.md. What I want this for is so that each of my projects can have a .hubconfig much the same as .arcconfig files that phabricator has. This will allow me to "force" all the users working on my project to fill out the same template.

Why would you want to apply a static pull request message to all pull requests opened in a project?

@mislav so maybe I am understanding this wrong. But i believe that when you set this it pulls up a message and lets you edit it? In this case I would have a template that would ask questions like how did you test this who should review this and why do think this should be merged in.

a yes so i was messing with it some more and it looks like I am incorrect. I thought -F would just apply a template that you could then fill out.

so it looks like I want two things.... one that is instead of -F something that would let you apply a template instead of just a message and then a config file that would let you set any flag including the newly added template flag such as -T.

There is a proposal to add an --edit option that can be used in combination with -F to provide a template file but also allow for editing it. #924

So what if the prepared-message.md file isn't present in some projects? What will hub pull-request do then if configured with -F prepared-message.md globally?

It would not be globally it would be per project but even if it was globally it would do the same thing that would happen if you passed in the -F flag. So if the file was missing it would throw the same error. It just a convenient way for allowing contributors to easily follow guidelines you may wish them to follow when contributing. I would strongly encourage using a different flag instead of using --edit. for #924. since -F seems to be for if you would want to pass in a generic message you have prepared and --edit with -F would be more so for helping to standardize the pull request process.

My overall hope is to be able to set something like the above config file in my root directory and then tell people that they must use hub or the provided template to make a PR. This would force them to fill out fields that I have provided and make the process overall easier to handle. I think tons of projects could benefit from integrating the workflow.

my strong push for this is because It would allow me to easily put processes in place at my company such as you have to fill out how you tested this and who should be reviewing this. But I see this very applicable across the board.

@michaeljs1990 We get a lot of feature requests at GitHub for issue/PR templates in general. It seems like you want the same at command-line. We can definitely work on making it happen in hub, since it doesn't seem it's very hard to implement technically. However you shouldn't expect that all contributors will switch to hub to open pull requests to your project. Most people will still continue to use the web interface.

I like the idea of having a .hubconfig (or similarly named) file in the root of a project. However, I don't understand your objection to --edit. Any reason why this wouldn't solve your use case?

hub pull-request -F my-template.md --edit

@mislav it would be impossible to get everyone to switch to using hub for an open source project but I could at least enforce that they use the template if opening from the web. For a company project though it would be very easy to enforce.

The reason I am not partial to -F with --edit is because I am not sure how one would set this in a config file i think it would have to look something like this.

{
    "pull-request.F": "prepared-message.md",
    "pull-request.edit": true
}

Both would work i think it just makes setting up the config file harder or you would have to do a mix of using the hub config and the command line which I think gets a little more confusing if you need to run

hub pull-request --edit

Maybe it's just preference though. I was envisioning this.

{
    "pull-request.T": "prepared-message.md"
}

I was looking over the PR above in more depth and it's definitely just my preference I don't have any real objection to --edit since you can accomplish the functionality I am thinking in the proposed .hubconfig.

Any progress on this? I'd like to set the default to create private repos for certain accounts.

The request in #2265 is not about preferences for a template/text file. Rather it would be nice to have a preference for a default format string to use in command like pr list -f

Also, several people mentioned that per project would be desired over per user. I can say without a doubt that an option for either is best. In our use cases setting at the user level would be much more convenient.

The request in #2265 is not about preferences for a template/text file. Rather it would be nice to have a preference for a default format string to use in command like pr list -f

The functionality that this issue ("default config") describes would allow you to set _any_ default flags for any commands, including the -f flag to hub pr list.

Also, several people mentioned that per project would be desired over per user.

When we implement this functionality, there will be a possibility to set either per-user default config or per-project. We will likely read something like .hubrc from the current directory and also up the directory ancestry tree. Per-user config would likely be stored in ~/.config/hub.

Was this page helpful?
0 / 5 - 0 ratings