The steps below can be used to merge two branches on your local machine. The braches used in this example are:
main
: The authoritative or “production” code lives in this branch.dev
: This branch is split from themain
branch and a new feature or update is coded with the intent to merge changes back into themain
branch.
Pull
main
anddev
branches so local repo is up to date with the remote.git checkout main
git pull origin main
git checkout dev
git pull origin dev
Checkout the main branch so we can merge the
dev
branch intomain
git checkout main
git merge dev
Check the branch status:
git status
Evaluate the two files with a conflict (ie.
.gitignore
andrequirements.txt
) and reconcile issues, thengit add
when ready.Commit the changes:
git commit -m "merge @tnelson-integral dev branch with main"
Push changes to the remote on GitHub:
git push origin main
Check out the
dev
branch locally and pull themain
branch changes into it sodev
can be up-to-date withmain
git checkout dev
git pull origin main
git push origin dev