-
Notifications
You must be signed in to change notification settings - Fork 12
4. Checkout a branch using GitBash
To make changes to the repository e.g. add new code or edit existing code it is good practice to do this on a branch other than the master branch so that any changes do not break a currently working version of the code. Once the repository has been cloned to your local machine, complete the following steps to navigate the branches.
-
Open GitBash and change your directory to where you have cloned the repository to on your local machine. If you are unsure on how to do this then follow instruction 2 here. You should navigate to the codonPython folder.
-
Then type the following into GitBash to list all available branches
$ git branch -a
All of the currently available branches will be listed. You can then use the branch names as a reference to navigate and checkout the desired branch. The branch with a * next to it is the branch you are currently on. It is good practice to never make changes directly to the master branch.
- Checkout the branch that you want to use by typing the following into GitBash.
git checkout <feature_branch>
- You can also create a new branch if required using the code below. We suggest that similar pieces of work should be completed on the same branch. Branch names should be simple and indicative of the work being done on that branch - see previous branch names for examples.
git checkout -b <issue/(feature, hotfix etc)/feature_defintion>
git pull
. This will pull all changes that have been pushed to the remote branch.
- Use the following code to confirm you are working on the correct branch.
git branch
The branch you have just checked out should now be highlighted with a *.
📧 Email us at [email protected] 🐦Find NHS Digital on Twitter 📘Check out the documentation for Codon