Previous Lecture lect11 Next Lecture

lect11, Tue 04/21

Thursday Lecture: feature-branch/pull request workflow

Feature Branch / Pull Request Workflow

When making a change to your team’s repo, you should typically NOT be making changes on the master branch

Reasonable exceptions: small changes to documentation only (not touching code).

So what do you do instead?

Whoa, whoa getting ahead of ourselves: issue first.

WAIT.

Before you start working on a branch:

Once your team is in steady state, you should always be assigned to at least one in-progress issue on the Kanban board.

Ok, got an issue. How do you make a feature branch?

Like this. Always start with a fresh copy of master:

git checkout master
git pull origin master
git checkout -b pcAddMenuItem

The pc are your initials (the person making the branch). The rest is camel-cased and summarizes the purpose of the branch.

You could also come up with a different branch name convention, one that works better for your team.

The important thing is to have one.

Working on a feature branch

You may need, periodically, to push your changes to GitHub. Use the branch name in place of master:

Rebasing on master

You may need, from time to time, to rebase your branch on master.

This is to say, replay all of the changes on your branch on top of a fresh copy of master.

To do this, type:

git pull --rebase origin master

You may have merge conflicts. If so, you may find that you have to resolve these merge conflicts one commit at a time.

If all else fails, you can always type git rebase --abort to abort the mission and start over.

But if you stay focused, you can get through it:

Eventually, you’ll have a new version of your branch, at which point you’ll want to:

git push --force origin pcAddMenuItem

Creating a Pull Request

When you create a pull request, you have to select a base branch and a compare branch.

You are requesting that the admins of the repo pull commits from the compare branch into the base branch.

Once you create a Pull Request, you should:

Reviewing a PR

If you are asked to review a PR, please do so promptly.

Diplomacy is good… it’s better to ask questions than make statements.

I wonder if this code would be clearer if factored out both the long if
part and the long else part into separate functions?   Choosing
some good names for those and some good parameter values might make this
code easier to understand.  What do you think?

vs.

This code is a convluded mess---so complicated that no-one could
possibly make sense of it.  You should totally rewrite this!

Both of these might be honest and understandable reactions to the same code. But one is much more likely to result in good team relations and team productivity. Choose wisely.

Today:

If your app is already recognizable as “yours”, great.

If not, consider adding a story to

First milestone: By one week from today, your app should be recognizable as your app.

Not yet MVP. Deadline for that two weeks from today.