Learn how to use Git and GitHub to manage your code and collaborate with others.
Git is a distributed version control system that helps you track changes in your code and collaborate with others.
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.
Start tracking your project with Git by initializing a new repository.
git init
Initialize a new Git repository in your current directory.
Add files, commit changes, and view your commit history.
git add .
git commit -m 'Initial commit'
git log
Add all files, commit with a message, and view commit history.
Push your local repository to GitHub to collaborate and back up your code.
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.
Download a project from GitHub to your local machine.
git clone https://github.com/username/repo.git
Clone a repository from GitHub.