Jed Rembold
May 20, 2025

If you are just getting started tracking a folder, you need to initialize Git in that folder
git init
.git folder to your folder, where Git stores
all its contentPerhaps the most used command will be to check the current status of Git in your folder
git status
which will print out information regarding the current state of the files
git add {file/folder name}
git commitGit has a logging function that will allow you to see information about your repository history
git logThere are a ton of customizations you can do to this output, but some include
--all shows the log of all branches, not
just the current--graph shows the connecting lines
between commits, including branching--decorate prints short names of
references--oneline compresses snapshot output to
fit on a single line for compactnessSometimes you might need to see what has changed between two states
The Git diff command will display an
output of all changes between two points
git diff {initial} {final} {filename}
{initial} is taken to be the
last commit and {final} to be the current
state of the files{filename} is not given, it will show
diffs on all files that have changedA history is of limited use if you can’t backtrack or move through it
The Git checkout command allows you
to “move” what you are currently looking at to a different commit
git checkout {desired commit}
Note that checking out a past commit actually changes the contents of your folder to reflect what it looked like at that time!
git branch command will take care of
all our branching needs
Without anything else, it will just print out a current listing of all branches and which is currently checked out
To create a new branch, you include a name for the new branch at the end of the command
git branch {new branch name}Merging is the act of creating a new commit based on the histories of multiple different commits
Git is pretty good at doing this intelligently, and often will just “figure things out”
To merge, have checked out the branch you want to merge into, and then
git merge {branch to merge into current}
So far we have great ways to manage our local histories, but still not great ways to collaborate
Git has a concept of remotes, which are basically just copies of a repository kept on a (most of the time) remote server
Git works locally 99% of the time, so there are special commands to use when you want to “sync” contents between your local repository and the remote repository
Before either can be done, we need to inform Git of where the remote for a given repository exists
git remote add {name} {url}
{name} is by convention
origin unless you are connecting multiple
remotes{url} is the address where that remote
can be reachedIn order for the remote to be useful, we need to let it know what we have done locally
Git calls this pushing changes to the remote
git push {remote name} {local branch}:{remote branch}Typing all that in can get old, so we can specify it once by saying
git branch --set-upstream-to={remote name}/{remote branch}
at which point in the future we could just do
git pushOn multi-computer setups, it is possible that another system uploaded content to the remote that you do not yet have locally
Git calls this fetching from the remote
git fetch
fetchGets the remote information, but does not merge it with your local content
To do both at the same time, you can do
git pullOften, you might be given a remote address initially, and need to copy that repository over to your local system
Git calls this cloning a repository
git clone {remote url} {directory name}
{remote url} is the url of where the
remote lives{directory name} is the local directory
you want to copy that remote repository into
This automatically sets up a remote for the new local git repository
README.md file, go through
and fill out the chartering template, to delineate the simple rules of
your team, your skill assessments, and your communication strategy