main
. Name the branch after the task. When a feature is done, push the feature branch to GitHub, create a pull request and merge the code into main
from the PR in GitHub.main
to Feature Branchmain
branch will be updated regularly and we will want to incorporate those changes to our feature branches on a regular basis to ensure new features are still compatible with main
. The following steps walk through how to merge changes from main
to our feature branches.main
) feature branch. Get latest changes on main
with git pull origin main
.main
that are needed in the feature branch, do a merge while in the feature branch: git merge main
main
into the feature branch, even if that code is not needed immediately. This best practice prevents very large changes in main
from being merged all at once.git status
to see what steps are needed.main
git push
, then create a PR to merge feature branch with main
on GitHub.git pull origin main
to get latest main
branch changes from GitHub.git branch -d <MY-FEATURE-BRANCH-NAME>
git push origin --delete <MY-FEATURE-BRANCH-NAME>
main
and work on new feature with git branch <MY-NEW-FEATURE-BRANCH>
App.js
or routes.js
on the back-end. For the most part, to avoid merge conflicts it simply takes a lot of communication when two people are both changing these centralized files. Ideally each new change would just be done one after the other, where one person waits to get the code of the second person.main
that has a conflict. If there is a merge conflict it should be resolved inside the conflicting branch first, before it's merged into main
.main
into Feature Branch Regularlymain
branch clean is to merge main
into the conflicting branch and make all necessary code edits in the conflicting branch. (this all happens on the local computer). Then push that (now clean) branch to GitHub.main
to our feature branch will be:git checkout <MY-FEATURE-BRANCH-NAME>
to checkout feature branchgit merge main
to merge the commits from main
to feature branchgit push
, then create a PR to merge feature branch with main
on GitHub.