There are currently two branches, the master branch and d-03-contact. Let’s assume that we’ve finished everything on the d-03-contact branch and we want to merge it back on to the master branch and then delete d-03-contact.
The current situation is that everything is up to date, the local and remote repositories match (this is because I just pushed all the changes to the remote at the end of the previous section).
To make sure there are no differences between the remote and local, we can do a fetch to check, click thebutton .
The fact that there are no numbers in theand buttons (highlighted) shows that there are no differences.
Next thing is to merge d-03-contact into the master branch locally. This is an identical process to that in § 6.7.1.
To merge branches, we must be on the receiving branch (the master branch). In Brackets switch to the master branch, click the arrow next to the selected branch in the left file tree pane and select from the drop down:
You should now be on the master branch; the 03-contact.html file will no longer be visible in the file tree:
To merge the branches, again click the arrow next to the master branch in the file tree and this time click the merge icon next to d-03-contact:
In the merge dialogue box, enter the merge message shown below:
Clickand the merge result box (there are no conflicts).
My new commit point is [da038e3], tag the new commit point with tag: P04.
Examining the commit history now shows:
Everything is back on the master branch (locally at least) and Brackets tells us there are six commits to push to the master branch on the remote repository.
This is because all those commits that were on the d-03-contact branch are now on the master branch (locally), but the remote repository knows nothing about them yet—hence six commits to push.
Make the push, click thebutton: .
As always, in the push dialogue box make sure thebox is ticked, leave everything else and click .
Close the response box and open the remote repository in GitHub. I now have 14 commits in total on the master branch, matching the local repository (Figure 8.69):
It is also showing the most recent P04 commit point [da038e3].
So that’s all good. Only thing now is to delete the d-03-contact branch, both locally and remotely.
There is one golden rule for deleting a branch in both a local and a remote repository:
ALWAYS DELETE THE REMOTE BRANCH FIRST
In Brackets switch to the d-03-contact branch. It will look like this.
Make sure you are on d-03-contact (highlighted).
You can only delete the remote version of the branch that is active locally. We don’t want to delete the master branch.
Now click thebutton: . This opens the push dialogue box:
This time select(highlighted), leave everything else and click . This give the following response:
Looks like it’s done it. Click.
Refresh the GitHub repository:
First thing: in the tab bar it shows just one branch (highlighted). Secondly, clicking the master branch in the dropdown.button there is only the
We’ve deleted d-03-contact from the remote repository.
This is just what we did in § 6.7.2.
In Brackets, switch back to the master branch. Click the small arrow next to the master branch in the file tree:
Click the cross next to the d-03-contact branch in the dropdown. Click in the “are you sure?” dialogue box.
That’s it; the d-03-contact branch is now deleted from both the local and remote repositories.
This is the final workflow—both locally and remotely: