Shell and DoC Systems, Lab 2
Remote Working, gitlab, and LabTS
Chapter 3: Programming Courseworks
git commit and push
Now we need to send those changes back to GitLab. LabTS uses the version of your code on GitLab for marking and assessment, so this is an important step for your coursework!
As mentioned previously, git helps you keep track of changes to your codebase. It doesn’t just track any arbitrary change, though. You have to let git know that you’ve made a meaningful change to the code.
You do this by making a “commit” to the repo.
To do this, we have to stage the changed files, like so:
git add greet.cpp
# or
git add greet.py
Next we actually make the commit, with the following:
git commit -m 'Your commit message here.'
Don’t forget to write a meaningful commit message! It helps you keep track of what was changed in each commit when looking back through the repo history.
For now, 'I fixed everything.'
will probably do!
And finally (finally!) we can “push” the changes to GitLab.
git push origin
If you open the repo on the web interface for GitLab, you should see your commit message appear in the history, and your changes should be reflected in the files.
Exercise 6
- Stage your changed file with
git add
- Commit your changes with
git commit -m '[Commit message]'
- Push your changes to GitLab with
git push origin
- Check that the changes are shown on the GitLab website