Motivation and set up in the JupyterLab workspace
Git is a technology or a system used for version control of code
- Frees up our code from our local machine (no risk of losing files from your laptop!)
- Ensures that we are tracking the changes of our code as a project progresses
- Allows us to revisit older versions of our code
- Allows us to keep different versions of our code
Git Hub is a "code hosting platform for version control and collaboration"
- Large community of open source project to browse
- Enables collaboration of many contributors in the same project
- Serves as a code vault for making our reasearch code findable and our methods transparent
Before we start working with Git in the command line, we will learn one more helpful skill. How to use a code editor. A code editors allows us to edit files in an environment without a graphical user interface. For us, it will be needed in some Git related tasks, so we want to be prepared.
Edit a file using nano in only 5 steps:
This will create a new file named hello.txt
. If the file already exists, it will open the file.
As you typically would type in any Document editor eg Google Docs. You can type for example, Hello Git!
CTRL
+
O
This will declare your willingness to save the file. Click ENTER
to verify that you want to save the file.
CTRL
+
X
Awesome, your file has just been saved! You can inspect using the head
command, eg head hello.txt
We will probably need soon nano
in one of our Git tasks.
To be able to use Git and GitHub from the command line we need to configure the information related to our GitHub user. Let's follow the commands below to set in the workspace the required information.
Replace <my github user name>
with your actual GitHub email.
git config --global user.name <my github user name>
Replace <my email associated with my github user name>
with your actual GitHub email.
git config --global user.email <my email associated with my github user name>
git config --global core.editor nano