Skip to content

Latest commit

 

History

History
154 lines (98 loc) · 3.02 KB

File metadata and controls

154 lines (98 loc) · 3.02 KB

🎯 Objective

This document serves as a beginner-friendly guide to understanding and using Git, a powerful version control system. It introduces Git's core purpose, explains commonly used commands such as cloning repositories, checking status, creating and switching branches, staging and committing changes, pushing and pulling updates, and merging branches. It also includes a image for a visual diagram to reinforce understanding of Git workflows. This guide aims to help new developers confidently manage code changes, collaborate on projects, and maintain clean development practices using Git.

Git Basics

📌 What is Git?

Git is a free and open-source distributed version control system. It helps developers track changes in source code during software development, coordinate work among team members, and manage code history efficiently.

Git Installation Confirmation

Git Setup Commands

# Set your name
git config --global user.name "daretechie"

# Set your email
git config --global user.email "deeprince2020@gmail.com"

🛠️ Common Git Commands

Here are some essential Git commands to get you started:

🔹 Clone a Repository

git clone <repository_url>

Clone

Copies a remote repository to your local machine.


🔹 Check Status

git status

Status

Shows the current status of files in the working directory and staging area.


🔹 Create a Branch

git branch <branch_name>

Branch

Creates a new branch.


###🔹 Switch to a Branch

git checkout <branch_name>

Branch

Switches to the specified branch.


🔹 Create and Switch to a Branch

git checkout -b <branch_name>

Branch

Creates a new branch and switches to it immediately.


🔹 Add Files to Staging

git add <file_name>
# or add all files
git add .

Add

Add file(s) to stage for committing.

🔹 Commit Changes

git commit -m "Your commit message"

Commit

Saves the staged changes with a message.


🔹 Push to Remote Repository

git push origin <branch_name>

Push

🔹 Pull Latest Changes

git pull

Pull

Fetches and merges changes from the remote repository into your current branch.


🔹 Merge a Branch

git merge <branch_name>

Merge

Merges the specified branch into your current branch.


🔹 The HTML

The html index is here.

html


🔹 GitHub Dashboard

GitHub Dashboard

🔹 Ownership Issue Resolved

Ownership issue

✅ Tips

  • Always pull before you push to avoid merge conflicts.

  • Use meaningful commit messages.

  • Branching helps in managing features, bug fixes, and experiments without affecting the main codebase.