Git Basics

TIP: References Quick List

Additional Info:

Git is a Source Code Management (SCM) / version control system.

Remote vs. Local

The premise with git is that there is an optional remote host where versions (commits) can be pushed up to or pulled down from. While the remote repository is optional, it is still recommended, even if you are the only developer working on a code base. Imagine dropping your laptop and losing a semester’s worth of work in one afternoon. A remote repository, even a private one that is only visible to you, provides a backup mechanism.

Locally, git will create a copy of the repository on your computer, whether or not you are connected to a remote server. By default, all changes you make are local. In order to sync with the remote copy of the repository, you need to:

FetchUpdate your local Git copy to tell it whether or not there are changes that could be pulled down from the remote git repository.
PullCopy / pull changes down to your local from the remote git repository. This is done branch-by-branch. More on that in a bit.
PushPush changes up to the remote git repository from your local copy.

Branching

Sometimes, you have a feature / bug fix that needs to be developed independently until it is complete. Other times, you may need to support multiple versions / releases of the code base at a given time. For either scenario, you can create a branch for the code to reside within.

Think of a tree, you may have a main trunk (often called the main branch) and have other branches

Next, let’s add our java101 project to git…

Git Basics

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.