Definition
The condensed definition: Git is a free and open source distributed version control system.
What does it mean? Git keep track of changes made to a project over time. It is usually used for collaborative projects to allow teams to collaborate seamlessly. Git is largely used among programmers developing source code. Git is agnostic in the sense that it can handle any set of files (text, binary, etc.). For this reason, a writer could also benefit from using Git to manage his book revisions.
Setup
Install Git and Create a GitHub Account
Follow the instructions here to install git.
Create a GitHub account here.
There are many other alternatives to GitHub such as GitLab, BitBucket or Google Cloud Source Repositories.
Your First Git Project
- Open the terminal
- Go to the location where you want to store your project. Create a new directory.
mkdir <project name>
cd <project name>
- Initialize a Git repository with a README file.
touch README.md
- Stage the README file.
- Commit the changes.
- Push the changes.
git init hello_world
cd hello_world
touch README.md
git add README.md
git commit -m "Initial commit"
git push -u origin master
Git Basics
Workflows
Basic Workflow
- Make progress / develop your project.
- Stage new and modified files.
Or stage all files at once (notice the dot):
- Commit your changes.
- Push changes.