Dev Patrache

Git 速查表

Setup

Safe
git config --global user.name "Name"

Set user name

git config --global user.name "Sam"

Safe
git config --global user.email "email"

Set email

git config --global user.email "[email protected]"

Safe
git config --list

Show all config

git config --list

Start

Safe
git init

Initialize a new repository

git init my-project

Safe
git clone <url>

Clone a remote repository

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

Changes

Safe
git status

Working directory status

git status

Safe
git diff

Compare changes

git diff HEAD~1

Safe
git add <file>

Add to staging

git add . / git add file.txt

Safe
git commit -m "message"

Create a commit

git commit -m "feat: new feature"

Caution
git commit --amend

Amend the last commit

git commit --amend -m "updated message"

Safe
git stash

Temporarily stash changes

git stash / git stash pop

Branch

Safe
git branch

List branches

git branch -a

Safe
git branch <name>

Create a new branch

git branch feature/login

Safe
git checkout <branch>

Switch branch

git checkout main

Safe
git checkout -b <name>

Create and switch

git checkout -b feature/login

Caution
git merge <branch>

Merge a branch

git merge feature/login

Caution
git branch -d <name>

Delete a branch

git branch -d feature/login

Danger
git branch -D <name>

Force-delete a branch

git branch -D feature/login

Remote

Safe
git remote -v

List remotes

git remote -v

Safe
git fetch

Fetch remote changes

git fetch origin

Caution
git pull

Fetch and merge

git pull origin main

Caution
git push

Push to remote

git push origin main

Danger
git push --force

Force push

git push --force origin main

Undo

Caution
git restore <file>

Discard file changes

git restore file.txt

Safe
git reset HEAD <file>

Unstage a file

git reset HEAD file.txt

Safe
git revert <commit>

Revert a commit (new commit)

git revert abc123

Caution
git reset --soft HEAD~1

Undo last commit (keep changes)

git reset --soft HEAD~1

Danger
git reset --hard HEAD~1

Delete last commit (discard changes)

git reset --hard HEAD~1

Inspect

Safe
git log

Commit history

git log --oneline --graph

Safe
git log --oneline

One-line history

git log --oneline -10

Safe
git show <commit>

Commit details

git show abc123

Safe
git blame <file>

Per-line author

git blame file.txt

Safe
git reflog

HEAD history (for recovery)

git reflog

最後更新:2026 · 免費線上工具

什麼是 Git 速查表?

免費線上Git速查表,按類別整理可搜尋的常用指令,涵蓋分支、合併、rebase、stash和reset,每條附帶語法說明並標註危險等級,避免誤刪提交。 可在編碼時於一處快速查閱程式碼、符號、快速鍵等參考資訊,在瀏覽器中即時搜尋與複製,無需註冊或安裝即可免費使用。 結果可一鍵複製,整個過程簡單快捷,無需下載任何軟體,在手機和電腦上都能隨時流暢使用。

使用方法

  1. 1
    輸入— 輸入所需資料。
  2. 2
    結果— 查看處理結果。
  3. 3
    複製— 複製結果使用。

相關工具

正則表達式速查表按詮釋字元、量詞、錨點、分組等類別整理正規表達式語法,支援搜尋和一鍵複製模式,並相容JavaScript正規表達式的免費正規速查表 適用於撰寫與測試正規表示式、SQL、程式碼格式化等開發工作,全部在瀏覽器本機處理,程式碼不會上傳伺服器,無需安裝或註冊即可免費使用。 結果可一鍵複製,整個過程簡單快捷,無需下載任何軟體,在手機和電腦上都能隨時流暢使用。
HTML 實體參考免費線上HTML實體參考,按類別列出命名與數字字元代碼,涵蓋箭頭、貨幣、數學符號等,可按名稱或符號搜尋,一鍵複製實體代碼到網頁中使用。 可在編碼時於一處快速查閱程式碼、符號、快速鍵等參考資訊,在瀏覽器中即時搜尋與複製,無需註冊或安裝即可免費使用。 結果可一鍵複製,整個過程簡單快捷,無需下載任何軟體,在手機和電腦上都能隨時流暢使用。
Linux 命令參考免費線上 Linux 指令參考工具,依檔案、行程、網路等類別整理常用指令,搜尋即可查到選項與用法範例,附帶說明幫助你快速記憶並提升終端機操作效率。 可在編碼時於一處快速查閱程式碼、符號、快速鍵等參考資訊,在瀏覽器中即時搜尋與複製,無需註冊或安裝即可免費使用。 結果可一鍵複製,整個過程簡單快捷,無需下載任何軟體,在手機和電腦上都能隨時流暢使用。

常見問題

是的,因為使用靜態資料所以可以離線使用。

本站使用 Cookie 以改善體驗和投放廣告。 瞭解更多