GitHub workflow basics

Hi, I’m trying to get a handle on how GitHub is used. Do people normally create a separate branch of every issue they want to work on, or is there some way to specify which individual commits to include in a pull request? I figured out how to fork the repo, commit changes for one issue, and create a PR for that, but now I want to work on a second issue and I’m not sure how to do that without including the not-yet-accepted changes from the first issue.

Generally speaking, you create a new topic branch for ever feature that you are working on.

No work should ever be done directly off of devel, create your topic branches off of devel and do your work there. If there is an already open issue for what you are working on, it’s common to name your branch something like ‘issue/12345’

I do something like:

git checkout devel
git fetch upstream
git merge upstream/devel
git checkout -b some-new-branch
git add something
git commit -m “Some commit”
git rebase -i upstream/devel
git push

I don’t normally run those all at the same time, but those are some common things that I do.

Yep, agreed.

Michael Dehaan has written a recent blog post on the merge/rebase element of this.

http://michaeldehaan.net/post/116465000577/understanding-when-to-use-git-rebase

To answer the original question, assuming you were working on a new feature called feature1 in branch feature1 and want to write a new feature feature2 without including what’s in feature 1 you can just do

git fetch upstream
git checkout -b feature2 upstream/devel

If you then need to merge upstream changes into your feature1 branch, that’s when you’d do

git checkout feature1
git pull --rebase upstream devel

Will