February 17, 2020
Git feature branches are a workflow that involves creating separate branches for each feature you want to build. When a feature is finished, it gets merged into the central master
branch.
This enables multiple features to be built in parallel on different branches, without overlapping over each other.
It also allows you to maintain a stable master
branch in case the feature gets thrown away or starts to ruin everything.
First make sure you're on the master
branch (if not, run git checkout master
to switch to it).
Then, create a new branch from master
and switch onto it (replace <feature_branch>
with the name you choose for your feature branch).
git checkout -b <feature_branch>
From here, you can do all your work as you would usually. Commit and push new changes for the feature to this new branch.
Once you're done with the your work on the branch and want to merge it into master
, run these four commands:
git checkout master
git pull origin master
git merge <feature_branch_name>
git push origin master
master
branchmaster
<feature_branch>
with your branch's name)Afterwards, you'll probably want to delete the feature branch. These two commands first delete the branch on the remote host, then delete the branch locally.
git push -d origin <feature_branch>
git branch -d <feature_branch>
Tufts Meal Plan Wrapped
Mar 2, 2024
Building an e-ink picture frame that displays an iCloud photo album
Jan 9, 2024
2023 in review
Jan 5, 2024
Subscribe to my newsletter for a monthly round-up of new blog posts and projects Iām working on!