Getting started with Git - GeoscienceAustralia/dea-notebooks GitHub Wiki

Getting started with Git

Saving your work on dea-notebooks

If you are accessing dea-notebooks resources via the DEA Sandbox or National Computational Infrastructure and wish to save your work between sessions, you will need to either clone a copy of our default resources or download your work each session. This is required because changes made to Jupyter notebooks in the DEA Sandbox or NCI environment may be overwritten as part of regular automatic updating, meaning any changes you make may be lost.

To create a personal copy of the default notebooks, you will need to get started with Git - a version control system that supports collaboration on code-based projects by intelligently tracking changes in files.

Read more about GitHub and Git.

Sign up for a free GitHub.org account

The guide 'Creating an account on GitHub' will help you to set up a free account on github.org which will allow you to create personal copies of DEA-notebooks resources and enable you to contribute your own code to the repository. To work with Git and the dea-notebooks repository, you can complete your Git-related actions directly in the github.com browser and via the command line in the DEA Sandbox and NCI environment. DEA Sandbox also has a Git API in the left hand workbench menu that simplifies many git tasks, eliminating most of the need to work on the command line.

Getting your own copy of dea-notebooks

To avoid losing your work between DEA Sandbox (or NCI) sessions, you will need to:

  • Create a folder in the directory structure and
  • Create a copy of the dea-notebooks into it (this is called creating a 'branch' of the dea-notebooks repository).

To do this inside the DEA Sandbox:

  1. Ensure you are logged in to the DEA Sandbox

  2. Open a new command-line terminal by clicking the blue "+" (New Launcher) button in the top-left corner to open the Launcher then click to open the Terminal. This is a Linux terminal for your Sandbox environment.

  3. Navigate to your home directory by typing the following:

    cd ~
    
  4. Clone a copy of dea-notebooks 'develop' branch into a new folder called dev by typing the following:

    git clone --depth 1 --branch develop https://github.com/GeoscienceAustralia/dea-notebooks.git dev
    
  5. Then, change into this folder as follows:

    cd dev
    
  6. Finally, create a new branch (copy) of the files with a name of your choice (replace 'your-branch' with a relevant branch name to you):

    git checkout -b your-branch
    

You will now have a persistent version of the dea notebooks that will not be overwritten by automatic updates. Don't forget to regularly compare to the default notebooks to check for updates and changes. You can do this by manually comparing to the top level notebooks in your DEA Sandbox directory or you can explore Git options to do this. This Git cheatsheet can help you get started.