Skip to content

Latest commit

 

History

History
108 lines (68 loc) · 1.85 KB

README.md

File metadata and controls

108 lines (68 loc) · 1.85 KB

Git Basics: A Quick Guide

Introduction

Git is a distributed version control system that helps you track changes in your code, collaborate with others, and manage your project's history. This guide covers the basic Git commands and concepts.

Getting Started

1. Installing Git

Before using Git, make sure it's installed on your machine. You can download it from here.

2. Configuring Git

After installation, configure your name and email:

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

Creating a New Repository

3.Initializing a Repository

    git init

3.Adding Files

    git add <filename>
    git add .

4.Committing Changes

    git commit -m "<commit message>"

5. Push the Change to server

    git push origin <branch name>

Working with Branches

1. Creating a Branch

Create a new branch for a feature or bug fix:

git branch <feature-branch>

2. Switching Branches

Switch to the new branch:

git checkout feature-branch

3. Merging Branches

Merge changes back into the main branch:

git checkout main
git merge feature-branch

Collaboration

1. Cloning a Repository

Clone a remote repository to your local machine:

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

2. Pulling Changes

Update your local repository with remote changes:

git pull origin main

3. Pushing Changes

Push your local changes to the remote repository:

git push origin main

Additional Commands

  • git status: Check the status of your repository.
  • git log: View commit history.
  • git diff: Show changes between commits.

https://www.figma.com/file/jEqOupFgUT4MSdxuv8ZBFH/Restaurants?node-id=1%3A3&mode=dev