Once you have made changes to an assignment and are ready to save your progress, there are a few steps that you must do prior to closing the hub if using git to keep your changes save. Once again, the interaction with git can be via Plugin user interface or a terminal session
Saving your changes and uploading them to GitHub is outlined and illustrated below:
Select the Git Plugin tab from the left sidebar
Files that have chaged will show under the Changed category. New files will appear under the Untracked category. Use to move your changes to the staging area (review git basic commands) and use the to unstage.
Once all files have been staged, you can commit your changes by typing a commit message
Confirm your commit
Finally, you need to push your commited changes to GitHub. You do so using the icon
Committing changes does not automatically save them to the repository! Don't forget to do step 5 and push the changes.
Launch a terminal on JupyterHub
Navigate to your current working assignment directory using the cd
command
From the directory containing your actively worked on assignment, you must first add and commit changes you have made which will be prepared to be saved remotely on the git repository. Think of this as staging any changes you have made, but not actually saving them yet. This first step provides the opportunity to add a commit message where you can document the changes you have made with this current save, which should be descriptive but not necessarily comprehensive.
Committing changes does not automatically save them to the repository! Don't forget to do step 3 and push the changes.
The -m flag means you are passing a commit message, which must be inside double quotes. If you forget to pass the message, it will launch the terminal editor emacs. You can type your message, save with Ctrl/Cmd+x
then Ctrl/Cmd + s
and quit using Ctrl/Cmd +
x
then Ctrl/Cmd + c
Once the changes have been stage following Step 2, the last step is to actually save the changes to the remote repository using the push command.
It will require you to enter your github credentials and then will begin to save the changes to your remote repository for the git classroom.
It is recommended that you git commit and push at the end of each working session or whenever a major change has been made to the codebase.