Back to Learning Paths

Git & GitHub Tutorial

Learn how to use Git and GitHub to manage your code and collaborate with others.

Video Tutorial

Introduction to Git

Git is a distributed version control system that helps you track changes in your code and collaborate with others.

Examples:

git --version

Check your installed Git version.

git config --global user.name "Your Name"
git config --global user.email "you@example.com"

Set your global username and email for Git commits.

Initialize a Repository

Start tracking your project with Git by initializing a new repository.

Examples:

git init

Initialize a new Git repository in your current directory.

Basic Workflow

Add files, commit changes, and view your commit history.

Examples:

git add .
git commit -m 'Initial commit'
git log

Add all files, commit with a message, and view commit history.

Connect to GitHub

Push your local repository to GitHub to collaborate and back up your code.

Examples:

git remote add origin https://github.com/yourusername/your-repo.git
git push -u origin main

Connect to a remote GitHub repository and push your code.

Clone a Repository

Download a project from GitHub to your local machine.

Examples:

git clone https://github.com/username/repo.git

Clone a repository from GitHub.