From 91df3eb42846179d2b3784e4a68a397d58b10c1d Mon Sep 17 00:00:00 2001 From: Ashmit Singh Date: Tue, 15 Apr 2025 16:44:18 +0530 Subject: [PATCH 1/9] doc: init repositories.md Signed-off-by: Ashmit Singh --- docs/tutorial/basics/repositories.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/docs/tutorial/basics/repositories.md b/docs/tutorial/basics/repositories.md index e69de29..d0d673a 100644 --- a/docs/tutorial/basics/repositories.md +++ b/docs/tutorial/basics/repositories.md @@ -0,0 +1,10 @@ +# Repositories + +```markdown + +# 🗃️ Git Repositories: A Quick Guide + +This guide explains essential repository operations in Git, including creating, connecting, cloning, and forking, along with a summary table of commands. + +--- + From b576cb4a5bb5128989f5635560c44903bab67573 Mon Sep 17 00:00:00 2001 From: Ashmit Singh Date: Tue, 15 Apr 2025 16:46:41 +0530 Subject: [PATCH 2/9] doc: updated repositories.md Signed-off-by: Ashmit Singh --- docs/tutorial/basics/repositories.md | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/docs/tutorial/basics/repositories.md b/docs/tutorial/basics/repositories.md index d0d673a..1a721fc 100644 --- a/docs/tutorial/basics/repositories.md +++ b/docs/tutorial/basics/repositories.md @@ -8,3 +8,23 @@ This guide explains essential repository operations in Git, including creating, --- +## 1️⃣ How to Create a Repository with `git init` + +To start a new Git repository in your local project directory: + +```bash +git init +``` + +This command creates a `.git/` folder that tracks all version history and enables Git operations. + +✅ **Example:** + +```bash +mkdir my-project +cd my-project +git init +``` + +--- + From fb58d8ee8c1e02d9add0e8ef1f9f0567fef5eb32 Mon Sep 17 00:00:00 2001 From: Ashmit Singh Date: Tue, 15 Apr 2025 16:54:28 +0530 Subject: [PATCH 3/9] doc: updated repositories.md completed Signed-off-by: Ashmit Singh --- docs/tutorial/basics/repositories.md | 66 ++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) diff --git a/docs/tutorial/basics/repositories.md b/docs/tutorial/basics/repositories.md index 1a721fc..5df183d 100644 --- a/docs/tutorial/basics/repositories.md +++ b/docs/tutorial/basics/repositories.md @@ -28,3 +28,69 @@ git init --- +## 2️⃣ How to Connect the Repository to a Global (Remote) Repository + +Once your local repo is ready, connect it to a remote repository (e.g., on GitHub): + +```bash +git remote add origin +``` + +✅ **Example:** + +```bash +git remote add origin https://github.com/username/my-repo.git +``` + +To push your code for the first time: + +```bash +git push -u origin main +``` + +--- + +## 3️⃣ How to Clone a Repository + +To copy a remote repository to your local machine: + +```bash +git clone +``` + +✅ **Example:** + +```bash +git clone https://github.com/username/project.git +``` + +--- + +## 4️⃣ How to Fork a Repository + +Forking a repository is done through platforms like GitHub: + +1. Go to the repository page on GitHub. +2. Click the **Fork** button (top right corner). +3. This creates a copy of the repo under your GitHub account. + +To work with the fork: + +```bash +git clone https://github.com/your-username/forked-repo.git +``` + +--- + +## 6️⃣ Summary Table of Commands + +| Command | Description | +|------------------------------------|-----------------------------------------------------| +| `git init` | Initializes a new Git repository locally | +| `git remote add origin ` | Connects local repo to a remote repository | +| `git push -u origin main` | Pushes commits to the remote for the first time | +| `git clone ` | Clones a remote repository to your local machine | +| *(Forking is done via GitHub)* | Fork a repo through the GitHub UI | + +--- +``` From f1374da7fa1146a27d124890c6e4639e9a933308 Mon Sep 17 00:00:00 2001 From: Ashmit Singh Date: Tue, 15 Apr 2025 16:58:32 +0530 Subject: [PATCH 4/9] doc: init committing.md Signed-off-by: Ashmit Singh --- docs/tutorial/basics/committing.md | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/docs/tutorial/basics/committing.md b/docs/tutorial/basics/committing.md index e69de29..0f2a3eb 100644 --- a/docs/tutorial/basics/committing.md +++ b/docs/tutorial/basics/committing.md @@ -0,0 +1,22 @@ +# Commiting Changes + +# Committing Changes in Git + +## Overview + +In Git, **committing changes** is the process of saving a snapshot of your project history. Before committing, files go through different stages. Understanding these stages is key to using Git effectively. + +--- + +## File Stages in Git + +Git tracks the state of every file in your project. These states define how Git sees each file before committing: + +### 🔹 Untracked Files + +These are new files in your working directory that Git doesn't know about yet. + +- **Not being tracked** by Git +- Will not be part of any commit until added + +--- From 83f3d81c3c6c54415e385c3f2aa1a103efc1bc83 Mon Sep 17 00:00:00 2001 From: Ashmit Singh Date: Tue, 15 Apr 2025 17:01:42 +0530 Subject: [PATCH 5/9] doc: complete committing.md Signed-off-by: Ashmit Singh --- docs/tutorial/basics/committing.md | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/docs/tutorial/basics/committing.md b/docs/tutorial/basics/committing.md index 0f2a3eb..0e0c53f 100644 --- a/docs/tutorial/basics/committing.md +++ b/docs/tutorial/basics/committing.md @@ -20,3 +20,28 @@ These are new files in your working directory that Git doesn't know about yet. - Will not be part of any commit until added --- + +- These files are ready to be committed + +--- + +### 🔹 Committed Changes + +Once files are staged, you can commit them to the repository history, creating a snapshot of the changes. + +--- + +## Summary of Commands + +| Action | Command | +| --- | --- | +| Check file status | `git status` | +| Add new/modified file to staging | `git add ` | +| Unstage a file | `git restore --staged ` | +| Commit staged changes | `git commit -m "message"` | + +--- + +## Conclusion + +Committing in Git isn’t just a single step—it’s the final stage in a flow that moves files from **untracked → unstaged → staged → committed**. Mastering this flow is essential for effective version control. \ No newline at end of file From f08c8aace04e55bfdf125de6206c82fcf5b50739 Mon Sep 17 00:00:00 2001 From: Ashmit Singh Date: Tue, 15 Apr 2025 17:11:12 +0530 Subject: [PATCH 6/9] doc: init history.md Signed-off-by: Ashmit Singh --- docs/tutorial/basics/history.md | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/docs/tutorial/basics/history.md b/docs/tutorial/basics/history.md index e69de29..3a94889 100644 --- a/docs/tutorial/basics/history.md +++ b/docs/tutorial/basics/history.md @@ -0,0 +1,22 @@ +# Viewing History + +# Viewing History in Git + +## Overview + +Viewing the history of your project in Git allows you to track changes over time. Git keeps a detailed record of every commit made to the repository. You can explore this history using various commands, each showing different aspects of the commit history. + +--- + +## Key Commands for Viewing History + +Git provides several commands to view your repository's history. Here's a summary of the most common ones: + +| Command | Description | +| --- | --- | +| `git log` | Displays the commit history. | +| `git log --oneline` | Shows a simplified log, one line per commit. | +| `git show ` | Shows detailed information about a specific commit. | +| `git log ` | Shows the commit history for a specific file. | + +--- From e3132fdeea7d2e3c83adbd28bf0bb29457b884a7 Mon Sep 17 00:00:00 2001 From: Ashmit Singh Date: Tue, 15 Apr 2025 17:12:51 +0530 Subject: [PATCH 7/9] doc: updated history.md Signed-off-by: Ashmit Singh --- docs/tutorial/basics/history.md | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/docs/tutorial/basics/history.md b/docs/tutorial/basics/history.md index 3a94889..ccf8d86 100644 --- a/docs/tutorial/basics/history.md +++ b/docs/tutorial/basics/history.md @@ -20,3 +20,21 @@ Git provides several commands to view your repository's history. Here's a summar | `git log ` | Shows the commit history for a specific file. | --- + +## Viewing Commit History + +### 🔹 Basic Log + +The most commonly used command to view the history of commits is `git log`. It shows detailed information about each commit, including the commit hash, author, date, and commit message. + +```bash +git log +``` + +### 🔹 Simplified Log + +For a more concise view, `git log --oneline` shows each commit in a single line, displaying the commit hash and the commit message. + +```bash +git log --oneline +``` From 3454667f90b2a29a74f8a55b6a7a1b1ed06928d6 Mon Sep 17 00:00:00 2001 From: Ashmit Singh Date: Tue, 15 Apr 2025 17:14:16 +0530 Subject: [PATCH 8/9] doc: updated history.md Signed-off-by: Ashmit Singh --- docs/tutorial/basics/history.md | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/docs/tutorial/basics/history.md b/docs/tutorial/basics/history.md index ccf8d86..5988816 100644 --- a/docs/tutorial/basics/history.md +++ b/docs/tutorial/basics/history.md @@ -38,3 +38,24 @@ For a more concise view, `git log --oneline` shows each commit in a single line, ```bash git log --oneline ``` + +### 🔹 Showing Specific Commits + +To view detailed information about a specific commit, use `git show `, replacing `` with the commit hash. This will display changes made in the commit, along with the commit metadata. + +```bash +bash +CopyEdit +git show +``` + +## Viewing History for Specific Files + +### 🔹 History of a Specific File + +If you want to view the commit history for a specific file, use `git log `. This will show all the commits that modified that particular file. + +```bash +git log +``` + From ae7bdd4b387fe4f92b6653faa86c49f3e77173dd Mon Sep 17 00:00:00 2001 From: Ashmit Singh Date: Tue, 15 Apr 2025 17:14:57 +0530 Subject: [PATCH 9/9] doc: completed history.md Signed-off-by: Ashmit Singh --- docs/tutorial/basics/history.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/docs/tutorial/basics/history.md b/docs/tutorial/basics/history.md index 5988816..df0f840 100644 --- a/docs/tutorial/basics/history.md +++ b/docs/tutorial/basics/history.md @@ -59,3 +59,8 @@ If you want to view the commit history for a specific file, use `git log ` git log ``` +## Conclusion + +Viewing the history in Git provides insight into how a project evolves over time. By using various log options and commands, you can easily track changes, identify contributors, and understand the development process. + +Mastering these commands will allow you to navigate your project's history with ease and efficiency. \ No newline at end of file