Basic Git

Basic Version Control System
- Built in a 4 month period in 2005 by the Linux community as a replacement for BitKeeper
- Implemented as a filesystem versioning system rather than a source control system
- Built-in server supports HTTP, SSH and local file protocols
- Allows many contributors to make changes to large projects with extremely small comparison times
- Popular SAS providers include SourceForge, Github, GitLab, and BitBucket
Git Paradigms

Definitions
- Repository - a folder that Git is tracking as your 'project'
- Branch - a version or 'copy' of your repository
- Commit - a particular 'save' point on a branch
- Remote - an online copy of your repository
- Push - add commits on your branch to a remote branch
- Pull - get commits from a remote branch to your branch
- Fetch - see which commits on a remote branch are available to be pulled
- Pull Request - a formal request that a copy of your branch be pulled into a repository
- Stash - store your changes without saving them
Definitions (continued)
- Merge - bring the work in one branch to another branch
- HEAD - the 'you are here' marker in your repository
- Staged - files that you want to include in your commit
- Tracked - files in your repository that you want Git to keep track of
- Tree - the branches and commits that make up the repository up to the HEAD
- Ancestor - a commit that came before another commit in the tree
- Rebase - move your changes from one commit to another commit with a common ancestor
- Checkout - change the branch your HEAD is at
- Submodules - other repositories inside your repository
Internal
Contributors to the repository are known and granted permissions to push and pull from the repository through access control mechanisms.
Open Source
The repository is publicly readable, but only writable by the project maintainers.
Use Cases
The repository is publicly readable, but only writable by the project maintainers.
Commits may be merged directly or through pull requests.
Commits may only be merged by pull requests.
Conventions
- The features of Git you will use will depend heavily on how the repository is organized and how the code is architected.
- The default branch is usually called 'master' or 'main'
- The default remote is usually called 'origin'
- Git Flow (introduced in https://nvie.com/posts/a-successful-git-branching-model/) is a common organization scheme
How to use Git
Start with a GUI
- Helps you visualize what you are doing with your repository
- Tower ($69)
- GitKraken (Free)
- SourceTree (Free)
- Fork (Free)
- Github Desktop (Free)
- VS Code (Free)
...or Keep it Simple with a CLI
- Nothing happens that you don't do explicitly
- Generally easier to find help with
- Requires some mental visualization
- Faster and universal cross-platform syntax
- Takes practice to get good at
Your first Git repository
$> cd my_project $> git init $> git add -A $> git commit -m "Initial Commit"
Git Resources
Go forth and code
Basic Git
By Cronocide
Basic Git
- 481