Spring cleaning

Before we can move onto Codespaces you need to clean up your git repositories.

Today you are going to do three things

  1. Merge all existing PRs

  2. Create and merge PRs for all open branches

  3. Delete old branches

1. Merge all existing PRs

  • At this point it doesn’t matter if they are approved or not—just merge them.

  • However, if you have PRs that represent recent work that you’d like me to review you may leave those open.

To merge PRs

  • Click the PRs link from any coding environment.

  • Open each PR and press the the green merge button.

2. Create and merge PRs for all open branches

  • You may have branches that you never made PRs for.

  • In order to merge them you need to make a PR and then merge it.

  • We will skip the step where you request a review and I review it. That is—today only—you may immediately click the merge button.

Getting to your old branches

  • Click the branches link from any coding environment.

Making PRs for old branches

  • Make a PR by clicking the “New pull request” button next to the branch.

  • Some branches may have no changes so you won’t be able to make a PR. Leave those for later.

Merge the new PR

  • You don't need to request a review or wait for approval.

  • If a PR cannot be merged cleanly, leave it and I’ll help you sort it out later.

  • Github will ask if you want to delete the branch after you merge. You can say, “yes”.

3. Delete old branches

You may have old branches whose PRs were merged but which never got deleted or branches that you never made any changes in.

All these branches can be safely deleted.

Delete merged branches

  • Go back to your list of all branches.

  • Next to any branch with a purple “Merged” pill click the trashcan icon.

Branches with nothing to merge

At this point the only branches other than main should be ones with no changes to be merged:

To double check, click the “New pull request” button for such a branch and you should see this:

Delete the branches with nothing to merge

  • You can safely click on the trashcan icon to delete these branches.

  • Do not attempt to delete the main branch. (Github probably won’t let you. But don’t try.)

Are you done?

You should have no open PRs (or maybe one or two if you have code you are actively working on that you want me to review.)

You should have only a main branch (unless you have open PRs in which case there will be one branch for each PR.)

Next

Codespaces