Developing some familiarity with the command line will come in very handy.
pwd
cd PATH
cd
cd
takes you to your
home
directory
rm PATH
rm -r PATH
cp SOURCE DESTINATION
cp -r SOURCE DESTINATION
mkdir PATH
mv SOURCE DESTINATION
When using paths on the command line you will come across some conventions.
.
..
~
/home/alice
(Linux
etc.) or /Users/bob
(Mac OS)
/
/home/alice/Desktop/code/2024-zebrafish-plots
if you are in
the Desktop
you could move into the plots directory in many
different ways:
cd /home/alice/Desktop/code/2024-zebrafish-plots cd ~/Desktop/code/2024-zebrafish-plots cd ./code/2024-zebrafish-plots cd ../alice/Desktop/code/2024-zebrafish-plots cd ./code/../code/../code/../../Desktop/code/2024-zebrafish-plots
The last is very silly on purpose to show you relative path movements.
You will come across the concept of absolute and relative file paths.
/home/alice/Desktop/code/2024-zebrafish-plots
/home/alice/Desktop/code/2024-zebrafish-plots
To install git follow the official instructions for your operating system:
homebrew
)
If you haven't used git on your computer before.
git config --global user.name "FIRSTNAME LASTNAME" git config --global user.email "YOUR-EMAIL"
Whenever you make a commit your name and email are used for the 'author' metadata.
You can also run the following to make git command output easier to read.
git config --global color.ui auto
Inside the folder you want to version control: git init
This will create the hidden .git
directory that git uses as
storage.
Cloning creates a copy of an existing repository on your machine. Depending on the address you use when cloning it will use a different form of authentication.
git clone git@github.com:erkannt/crop-and-rotate.git
git clone https://github.com/erkannt/crop-and-rotate.git
The workflow is always:
git add .
git add PATH
git add -p
git commit -m "MESSAGE"
git commit
git restore PATH
git restore --staged PATH
git reset --hard
There are a variety of ways to see what has happened in the past and what your current state is.
git status
git log
git log --graph --oneline --decorate --branches --all
git diff
git show
git show SHA
git log
)
git pull
git push
git pull --rebase
git remote -v