Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Deploy docs

on:
push:
branches: [ main ]
workflow_dispatch:

jobs:
build-deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.x"
- run: pip install -r requirements.txt
- run: mkdocs build --strict
- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./site
37 changes: 37 additions & 0 deletions docs/branching/branching.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# 🌿 Branching
Branches let you work on features, fixes, or experiments **without affecting** the `main` branch.

---

## 📋 List Branches

```bash
git branch
```

* `*` marks the branch you’re currently on.
* Add `-a` to see remote branches too:

```bash
git branch -a
```

---

## 🌱 Create a New Branch

```bash
git checkout -b feature-name # Old way
git switch -c feature-name # Newer, simpler way
```

**Tip:** Start branch names with a short prefix, like `feature/`, `bugfix/`, or `hotfix/`.

---

## 🔄 Switch to an Existing Branch

```bash
git checkout branch-name # Old way
git switch branch-name # New way
```
36 changes: 36 additions & 0 deletions docs/extras/aliases.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# 🧠 Useful Git Aliases

Aliases let you create short commands for commonly used Git operations.

---

## Common Aliases

```bash
git config --global alias.st status # git st → git status
git config --global alias.co checkout # git co → git checkout
git config --global alias.br branch # git br → git branch
git config --global alias.ci commit # git ci → git commit
git config --global alias.lg "log --oneline --graph --all"
# git lg → compact visual commit history
```

---

## More Handy Aliases

```bash
git config --global alias.unstage "reset HEAD --"
# git unstage file.txt → remove file from staging area

git config --global alias.last "log -1 HEAD"
# git last → view details of the last commit
```

---

## View All Aliases

```bash
git config --get-regexp alias
```
56 changes: 56 additions & 0 deletions docs/history/log.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# 📜 View Commit History

## Basic Log

```bash
git log
```

Shows detailed commit history (hash, author, date, message).

---

## One-Line Summary

```bash
git log --oneline
```

Short commit hash + message (good for quick scanning).

---

## With Graph View

```bash
git log --oneline --graph --all
```

Shows branch structure and merge history in a compact view.

---

## Filter by Author

```bash
git log --author="Your Name"
```

---

## Filter by Date

```bash
git log --after="2024-01-01"
git log --before="2024-06-30"
```

---

## View Changes in Each Commit

```bash
git log -p
```

Adds the diff for each commit.
45 changes: 45 additions & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<p align="center">
<h1 align="center"><img src="https://img.shields.io/badge/Git-F05032.svg?style=for-the-badge&logo=Git&logoColor=white" alt="Git">
Command Guide</h1>
</p>
<p align="center">
<!-- Stars -->
<img src="https://img.shields.io/github/stars/bensonngu/git-command?style=for-the-badge&color=FFD700" alt="Repo Stars">

<!-- Forks -->
<img src="https://img.shields.io/github/forks/bensonngu/git-command?style=for-the-badge&color=FF8C00" alt="Repo Forks">

<!-- Watchers -->
<img src="https://img.shields.io/github/watchers/bensonngu/git-command?style=for-the-badge&color=1E90FF" alt="Repo Watchers">

<!-- Open Issues -->
<img src="https://img.shields.io/github/issues/bensonngu/git-command?style=for-the-badge&color=DC143C" alt="Open Issues">

<!-- License -->
<img src="https://img.shields.io/github/license/bensonngu/git-command?style=for-the-badge&color=228B22" alt="License">

<!-- Last Commit -->
<img src="https://img.shields.io/github/last-commit/bensonngu/git-command?style=for-the-badge&logo=git&logoColor=white&color=8A2BE2" alt="Last Commit">
<p>

A concise guide demonstrating the fundamental Git commands and typical workflow for managing repositories on a local machine.

## 🧭 Quick Links

- 🧾 [Initialize & Configure](setup/init.md)
- ⚙️ [Configure Git (First Time Only)](setup/config.md)
- 🔍 [View Current Git Settings](setup/view-settings.md)
- 🛠 [Other Useful Git Settings](setup/other-settings.md)
- 🧽 [Remove or Edit a Git Setting](setup/edit-settings.md)
- 🔄 [Basic Git Workflow](workflow/basic.md)
- 🌐 [Remote Repository Setup](remote/setup.md)
- 🌿 [Branching](branching/branching.md)
- 🔀 [Merging](merging/merging.md)
- 📥 [Pull Strategies](remote/pull-strategies.md)
- 📂 [Clone an Existing Repository](remote/clone.md)
- 📜 [View Commit History](history/log.md)
- 🧹 [Undoing Changes](undo/undo.md)
- 🧠 [Useful Git Aliases](extras/aliases.md)

!!! tip "Copy buttons"
Every code block has a copy button on the right—use it on mobile too.
63 changes: 63 additions & 0 deletions docs/merging/merging.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# 🔀 Merging

Merging combines changes from one branch into the branch you’re currently on.

---

## Basic Merge

```bash
git merge feature-name
```

This merges the branch `feature-name` into your current branch (often `main` or `develop`).

---

## Fast-Forward Merge *(no new commit created)*

If no other changes have been made in the target branch since branching:

```bash
git merge --ff-only feature-name
```

✅ Keeps history clean without extra merge commits.

---

## When Conflicts Appear

If you see a merge conflict:

1. Open the affected files in your editor.
2. Look for conflict markers:

```
<<<<<<< HEAD
Your changes
=======
Their changes
>>>>>>> feature-name
```
3. Edit to keep the correct content.
4. Stage the resolved files:

```bash
git add .
```
5. Complete the merge:

```bash
git commit
```

---

## Check Merge Status

```bash
git status
```

Shows if the merge is in progress or complete.
70 changes: 70 additions & 0 deletions docs/remote/clone.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# 📂 Clone an Existing Repository

## 1. Standard HTTPS Clone *(Most Common)*

```bash
git clone https://github.com/username/repo-name.git
```

Copies the entire repository (all branches, full history) into a new local folder named after the repo.

---

## 2. Clone via SSH

```bash
git clone git@github.com:username/repo-name.git
```

**When to use:** If you’ve set up an SSH key with GitHub (or another provider) and want to avoid typing your username/password every time.

---

## 3. Clone a Specific Branch Only

```bash
git clone --branch branch-name --single-branch https://github.com/username/repo-name.git
```

**When to use:** If you only need one branch and want to save bandwidth/time.

---

## 4. Shallow Clone (Latest Commit Only)

```bash
git clone --depth 1 https://github.com/username/repo-name.git
```

**When to use:** If you only need the latest snapshot and don’t care about full commit history.

---

## 5. Clone into a Custom Directory

```bash
git clone https://github.com/username/repo-name.git my-folder
```

**When to use:** If you want the local directory name to be something other than the repo name.

---

## 6. Clone with Submodules

```bash
git clone --recurse-submodules https://github.com/username/repo-name.git
```

**When to use:** If the repo contains submodules and you want them initialized and checked out automatically.

---

## 7. Mirror Clone (Full Backup/Migration)

```bash
git clone --mirror https://github.com/username/repo-name.git
```

**When to use:** For backups or repository migration.
Includes all refs (branches, tags, remote-tracking branches).
Loading