Git_Terminal cheat sheet
Git_Terminal cheat sheet
pwd: stands for “Print Working Directory.” In other words, will show the absolute
path to your current directory
Absolute paths: an absolute path starts with / specifying the root directory (the
‘root’ of the directory tree) and goes down the branches to a specific location. An
absolute path will take you to the same spot every time and is not dependent on
your current directory.
Relative paths: are far shorter than absolute paths and are usually as simple as
just putting in the name of a directory/file you found from an ls. However, this is
dependent on your current directory meaning a relative path won’t work unless you
are in the right spot
cd ..: moves you to your current directory's parent directory. Can be used multiple
times in a row (cd ../..) to go back a desired number of directories. Note this
doesn’t work like ctrl z. It will take you to the parent directory, not the
previous directory.
cd ~: moves you to your home directory (this is not the root directory)
Control C: will terminate a process. You may want to cancel certain commands that
either take a long time or intentionally run indefinitely until you tell them to
stop.
Git
Github (These commands are assuming that the github repository has already been
made. If you wanted to make your own repository, just copy and paste the
instructions from github into terminal)
git push: pushes the local commit you made to the github repository
git pull: pulls the latest version from the current branch so you can work on it
git clone [link]: grabs a copy of a repository from github and puts it on your
computer.
git checkout: switches which branch you are pulling from / pushing to.