Repositories
A git repository is a folder containing your project's files, as well as a detailed log of the history of the edits to these files. Repositories can be hosted online for collaboration - we use GitHub for this. More about GitHub repositories can be found in the GitHub docs.
The repositories for all of Nesta's projects are stored in the Nesta GitHub account here.
There are two ways to link a GitHub repository to your computer so that you can begin working on the files locally 1. Create a new repository 2. Clone an existing repository
Creating a new repository
Setting up a new git repository locally is really simple:
cd project/folder/
git init
More about this can be found in Git Guides.
Nesta's data science cookiecutter
Alternatively, Nesta have detailed guidelines about our approach to create a new project. This effectively involves running:
cookiecutter https://github.com/nestauk/ds-cookiecutter
and following the prompts to create a new project. The full guidelines and requirements for using this can be found in our Cookiecutter documentation pages here.
This method automates creating the project structure and git repository locally (amongst other things).
We encourage everyone to use this cookiecutter approach in setting up a project since it helps our project structure to be standardised and therefore quickly familiar and accessible for new people working on the project.
Once you have created a new project locally using the cookiecutter, you will need to create a new repository on GitHub and link it to your local project folder. This can be done by following the instructions below.
Creating a repository on GitHub
There are generic guidelines on how to create a repository on GitHub here.
However, to create a new repository on the nestauk
account, you need to open an issue here and wait until a member of the team creates it for you.
Once your new repository has been created on GitHub, you need to link your local project folder to the remote repository on GitHub - see the instructions here.
Cloning an existing repository
If you want to collaborate on an existing project, you can download the codebase locally by simply running
git clone git@github.com:nestauk/<repo name>.git
Working on the repository
Following both of these approaches will create a new folder on your computer which is linked to an online GitHub repository. You will automatically be in the main branch (which is usually called dev
) of the project and any edits made to existing files will now be tracked. Now you are ready to start editing and adding files using the Git workflow.