-
Notifications
You must be signed in to change notification settings - Fork 15
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).
Go to the Issues page on the class repo and either leave a comment on an issue/task that you want to work on so that I assign it to you, or click the "New Issue" button to create a new task for yourself.
In the Issue's description (or in your comment response) explain how you plan to execute this task. Describe what you imagine your steps are going to be while working on this task. What sorts of functions will you create? What sort of logic do you need? Are you planning on working with any data? If you found a tutorial you think could help, mention it and link to it, if you found a library you plan to use, mention and link to that as well. Once I've approved your plan you can get started working on your feature.
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 chosen or 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. Make sure to create clear commit
messages that will make sense to your other collaborators. These should be brief, but clear. NOTE make sure you don't commit any code that has linting errors (see coding style), always check to make sure you're conforming to our StandardJS coding style before committing code.
It's common that you'll make a few commits as you work on your task, it's good practice to backup your work when you're finished working for the day by push
ing 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