Two years ago, my senior introduced me to Git and GitHub through a short guide, which gave me a solid foundation in version control. Now, I’ve expanded that initial guide into a comprehensive yet concise resource for beginners. This guide covers everything you need to get started with Git and GitHub, including installation, account setup, and basic Git commands to manage your code efficiently.

1. Installing Git

For Windows:

  1. Download Git from Git for Windows.
  2. Run the installer and follow the steps, making sure to select “Git Bash Here” for easier access.

For macOS:

  1. Open Terminal and install Git with:
   brew install git

For Linux:

  1. Open Terminal and install Git with:
   sudo apt update
   sudo apt install git

2. Setting Up Git

After installation, configure Git with your username and email:

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

3. Setting Up GitHub

  1. Sign up for a free account on GitHub.
  2. Verify your email and set up your profile.

4. Cloning a Repository

To start working on an existing GitHub project locally:

  1. On GitHub, go to the repository and click “Code”, then copy the URL.
  2. Open Terminal or Git Bash and run:
   git clone https://github.com/username/repository-name.git
   cd repository-name

5. Basic Git Commands

  • Stage changes:
  git add .
  • Commit changes:
  git commit -m "Describe your changes"
  • Push to GitHub:
  git push origin main

6. Checking Status

You can always check the status of your repository with:

git status

This guide now provides a more thorough understanding of Git and GitHub compared to the one I was taught. I hope this helps beginners get started with confidence!