3 Creating our own branch
After the pull, we are now safely up to date with the remote changes. Now it is time to learn how to create our own ‘branch’, from which we will start working on new code. We use the following command:
git checkout -b <name-of-branch>
The command git checkout <name-of-branch>
is used to change from one branch to another (so that you will now see the files and changes that are in that branch). Additionally, if we add the -b
option, it will create the branch with the given name if it does not already exist, which is our case in this example. The branch name should be something like author/name-of-branch
. Thus, some common practices for naming your branches (and that we should follow) are:
- They do not contain caps (all lowercase)
- Words are separated with dashes (
-
) - The name includes the author and some descriptive name separated by a slash (
/
) - The descriptive name should ideally start with an action (a verb) in imperative style (fix, create, test…).
If Ermenegildo wants to create some code for preprocessing bilateral trade data, an acceptable branch name could be ermenegildo/preprocess-bilateral-trade-data
.