Lecture 1.5: Git
The lecture notes for this lecture are a bit different. This lecture is heavily inspired on an article and lecture given in Cambridge.
Therefore, I'd like to refer you to the original video lecture:
And the original article:
https://missing.csail.mit.edu/2020/version-control/
It, and the lecture we gave are both licensed under CC BY-NC-SA.
Changes
- We also talked about how to use CLion and git within a Rust project
- Custom part about remotes, with Gitlab, and merge requests
Extra: Git aliases
In the lecture, I used an alias called git nicelog
. To make such an alias, you can apply the following instructions (on linux).
On windows, it will be similar, but I can't test the details, so you may need to apply some trial and error.
- Make a directory called
scripts
anywhere on your systems. The name doesn't need to be scripts, but that's what I like to do. - Add this directory to your path. To do this, edit a file called
.bashrc
or.zshrc
(hidden file in your home directory) and add the following to it:export PATH="/path/to/your/scripts:$PATH"
and replace the path with the absolute path to your scripts directory- Note that you may need to reopen your terminal after this, or run
source ~/.bashrc
/source ~/.zshrc
- now, make a file in the scripts directory called
git-nicelog
(name needs to start with git, then a-
and then the name of your alias) - Put the following in the file:
#![allow(unused)] fn main() { #!/usr/bin/bash git log --all --graph --decorate }
- The first is to say that it's a bash script, and the second line is the command to execute instead of
git nicelog
. - Now make the file executable using
chmod +x git-nicelog
. - Now, anywhere on your system, type
git nicelog