Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Branch name when doing a pull request

I've done a few pull requests on GH already, but I committed to the master branch. Now I read on various places that it's a good idea to create a branch.

Are there any guidelines for branch naming? I usually work with Mercurial and give my branches the same name as their relevant bug ticket ID, but that doesn't work for this.

I've looked at a few repositories: some commit to master, some commit to fix-somebug, some commit to patch-1. I understand that this doesn't create conflicts, because pull requests are merged to master (or a different, long living branch) and the branch is then deleted, is that correct?

like image 970
user247702 Avatar asked Jul 03 '13 10:07

user247702


People also ask

Does a pull request Need a branch?

A branch is just a separate version of the code. A pull request is when someone take the repo, makes their own branch, does some changes, then tries to merge that branch in (put their changes in the other person's code repository).

Should I make a new branch for each pull request?

It's a good practice to create a new branch for every new bit of work you start doing, even if it's a very small one. It's especially useful to create a new branch for every new feature you start working on. Branches are of course disposable, you can always remove them.

What is the branch name in GitHub?

The main branch — the one where all changes eventually get merged back into, and is called master. This is the official working version of your project, and the one you see when you visit the project repository at github.com/yourname/projectname.


1 Answers

The idea behind a branch for a pull request is to allow for said branch to be automatically deleted once the pull request is accepted.

And since April 2013, that branch will be deleted for you:

merge button

You are then suppose to update/rebase your master from the master of the upstream repo in order to get what you developed in isolation a branch from the official repo that you have forked (since that repo has accepted your pull request)

upstream

The name of the branch should represent the development effort you are engaged in.

like image 60
VonC Avatar answered Sep 23 '22 00:09

VonC