Bolaji Ayodeji
Software Engineer, Teacher, and Developer Advocate.
This is the process of tracking and managing changes to software code or a set of files over time.
A version control software keeps track of every modification to the code in a special kind of database.
If a mistake is made, developers can restore and compare earlier versions of the code to help fix the mistake while minimizing disruption to all team members or contributors.
CentralIzed VCS
Distributed VCS
Code backups
Preserves efficiency and agility
Source code management
Traceability
Branching and merging
Reverting changes
Effective collaboration
Git is the most widely used modern version control system in the world today. It is a distributed and actively maintained open source project originally developed in 2005 by Linus Torvalds, the famous creator of the Linux operating system kernel.
Git is a Free and Open Sourced Distributed Version Control System
Unlike older centralized version control systems such as SVN and CVS, Git is distributed: every developer has the full history of their code repository locally. Git also works well on a wide range of operating systems and IDEs (Integrated Development Environments).
//macOS
brew install git
//Linux
sudo apt install git-all
//Windows
choco install git
git init
// Creates or initializes a new git repository
git add index.js or git add * or git add --all
// Proposes this new change and adds it to the index
git remote add origin https://github.com/<GitHub username>/<repo name>.git
// Adds the remote copy to origin repository
git push -u origin main
// Set origin as the upstream remote in your git config (branch main)
git status
// Check what has been going on in git, see whats staged or not.
git commit -m "commit description"
// Tell us what you did and add to HEAD
git push origin main
// Push HEAD to the remote repository
git log
// See the repository history
git pull
// Grabs the latest directory with updates from the remote repository
git clone <url>
// Clone a remote repository to local
git branch staging
// Creates a new branch named 'staging'
git checkout -b <branch name>
// creates a new branch named <branch name> and switches to it
git checkout main
// switch back to the master branch
git branch -d <branch name>
// deletes the branch named <branch name>
git push origin <branch name>
// push your branch to remote repository
git merge <branch name>
// merge <branch name> into main
git config --global user.name "Your username here"
git config --global user.email "your email here"
git config --global color.ui true
git config --global core.editor emacs
git config --list
Get the GitHub Student Developer Pack which gives you access to the best developer tools and courses for FREE
By Bolaji Ayodeji
Introduction to version control, version control systems, Git and GitHub plus practical usage, code, tips, and resources.