Create Branch and push (code should never exist in just one place).
$ git checkout -b feature-branch main // creates a local branch for the new feature
$ git push origin feature-branch // makes the new feature remotely available
Changes made to main
should be merged back into the feature branch.
$ git merge main // merges changes from main into feature branch
When development on the feature is complete, the lead (or engineer in charge) should merge changes into main
and then make sure the remote branch is deleted.
$ git checkout main // change to the main branch
$ git merge --no-ff feature-branch // makes sure to create a commit object during merge
$ git push origin main // push merge changes
$ git push origin :feature-branch // deletes the remote branch
$ git push origin --delete feature-branch // deletes the remote branch alternative syntax