Git Basics

What is Git?

Git is a distributed version control system that tracks changes in your code, allows collaboration with others, and maintains a complete history of your project.

Installing Git

Windows

Download and install from git-scm.com

macOS

brew install git

Linux

sudo apt-get install git

Basic Git Commands

Configure Git

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

Initialize a Repository

git init

Clone a Repository

git clone <repository-url>

Check Status

git status

Add Files

git add <file>
git add .  # Add all files

Commit Changes

git commit -m "Your commit message"

Push to Remote

git push origin main

Pull Changes

git pull origin main

Working with gityar

Clone Your Repository

git clone http://localhost:3000/username/repository.git
cd repository

Make Changes and Push

# Edit files
echo "# My Project" > README.md

# Stage and commit
git add README.md
git commit -m "Add README"

# Push to gityar
git push origin main

Next Steps