Introduction to Git
Thomas J. Kennedy
Contents:
Git is a Version Control Platform that allows an individual or a team to track changes to a codebase. This includes maintaining records of what changes were, when changes were made, and by whom changes were made. This not only facilitates tracking progress.
Git allows one to:
- Explore alternative approaches.
- Reconcile conflicting changes (through
merge
andrebase
). - Compare differences between branches and commits.
1 Basic Commands
Before we can discuss merge and rebase, we must focus on the basic commands:
git init
- Initialize a repository (repo) in the current directorygit clone
- clone (i.e., copy) a remote repo.git add
- record files or changes to files.git rm
- remove one or more filesgit commit
andgit commit -m
- package together all staged changesgit push
- push (i.e., send) all local changes to a remote repo.git pull
- pull (i.e., retrieve) all changes from a remote repo.git log
- examine the commit history. This covered in a future section.
1.1 Getting Started
Let us focus on how each command is used in situ.
Let us start with a local repository (repo). Watch this recorded discussion.
This section will be expanded as we work through the next few lectures.