-
Notifications
You must be signed in to change notification settings - Fork 16
the "feature branch" workflow
As we begin working on the new direction for our collaborative artware, we're going to add a few more steps to our workflow so that our process more closely resembles a "feature branch" workflow (which is one of the most common git workflows when working on open source projects).
The first thing you'll do before starting on a new task is pull changes from the class repo so that you have the latest version of our artware before you start working on your new feature. Make sure you're on the main
branch (you can run git branch
to check which branch you're on) and then pull changes from the class repo git pull upstream main
Assuming you've already created an Issue for the particular "feature" you plan on working on as your next task, you'll want to create a new "feature branch" off of the main branch like this:
git checkout -b [FEATURE-NAME]
replacing [FEATURE-NAME]
with the name of your particular feature
As you work locally, all the commits you make will be saved to this new branch. NOTE make sure you don't commit any code that has linting errors, always check to make sure you're conforming to our StandardJS coding style before committing code.
If you want me to take a look at your code before you're ready to create a PR, you can always push your new feature branch up to your forked repo by running git push origin [FEATURE-NAME]
, as opposed to git push origin main
.
Make sure you've pushed your feature branch to your forked repo on GitHub git push origin [FEATURE-NAME]
. Then, just as we've done before, create a new pull request by navigating to the Pull Request (PR) tab on either the class repo's page or your forked repo's page. Click on the green "New pull request" button and this time make sure the request is going from the feature branch of your fork into the main branch of the class repo. The arrow icon between the two conveys the direction of the pull request.
net-art-uchicago/paintArtware2.1 [main] ← your-username/paintArtware2.1 [your-feature]
Give the pull request a name/title that matches the name/title of your feature. I will review your PR and leave comments, once you've addressed all the comments I'll merge your PR and you'll be almost ready to start working on your next feature.
After your PR has been merged, it's best to do a little clean up before working on your next feature. Unless you plan on continuing to work on this feature, it's best you delete the old feature branch to avoid cluttering your repo up with lots of inactive branches.
first switch over to the main branch
git checkout main
all the code you wrote in your last feature will disappear (because it's in your feature branch, and not in your main branch yet). because your feature was merged into the class repo you can pull it (and any of your classmates features) down into your main branch from the class repo's main branch:
git pull upstream main
now that your main branch is all up to date, let's delete the old feature branch off of your "remote" repo on GitHub:
git push origin --delete [FEATURE-NAME]
lastly, we'll delete the branch from your "local" repo on your computer:
git branch --delete [FEATURE-NAME]
you're now ready to go back to step 1 and start working on your next feature