Git and GitHub : Part 1

Git and GitHub : Part 1

 

 Introduction, Installation, and Basic Commands

1. Introduction to Git

  • What is Git?
    • A free, open-source distributed version control system.
    • Tracks changes in source code during software development.
    • Helps collaborate on projects with multiple contributors.
  • Why use Git?
    • Version control ensures every change is documented.
    • Easy to revert to previous versions if needed.

2. Installing Git

Steps for Installation:

  • Visit Git's official website.
  • Download the appropriate installer for your operating system (Windows, macOS, or Linux).
  • Follow the installation wizard to set up Git on your system.

Post-Installation Setup:

  • Configure Git with your name and email:
git config --global user.name "Your Name"
git config --global user.email "[email protected]"

3. Basic Git Commands

Initialize a Repository:

  • Creates a new Git repository in the current folder.
git init

Check the Status of Your Repository:

  • Displays the current state of the repository.
git status

Stage Changes:

  • Adds specific files to the staging area.
git add <file_name>
  • Stages all changes in the current directory.
git commit -m "Commit message"

Commit Changes:

  • Saves staged changes with a descriptive message.
git commit -m "Commit message"

View Commit History:

  • Shows a history of commits in the repository.
git log

 

Comment