So this is the current branches for this tutorial repositort just as a hypothetical example :
— Branches (NB!! -> Only 1 example branch | develop | also the main branch in this example)
develop
—
Step 1 :
Create a new branch for a new feature
git checkout -b new-branch-name-goes-here
Step 2 :
When your new branch is ready to submit code back into the system. First step you need to publish the branch to github. Assuming you haven’t already done it.
git push --set-upstream origin new-branch-name-goes-here
Step 3 :
Now that your branch is published you can add and commit your changes to
new-branch-name-goes-here
git status git add -A git commit -m "Your new message to describe what you have done goes inside these inverted commas" // Ensure your branch is up to date with your latest changes by running git status again git status // If your branch say up to date then you are good. Else you have done something wrong and need to try again.
Step 4 :
You can switch back to your main branch which you will then merge the new branch you were working on back into your main branch. In this case our main branch is develop
git checkout develop git merge new-branch-name-goes-here
Step 5 :
After you run “git merge new-branch-name-goes-here” you gshould get notified of all the conflicts if there are any.
Resolve the conflicts in your IDE (Integrated Development Environment) and then push your now updated main branch (develop) back into itself.
git push origin develop