Engineering Tools for AI

Lập trình

Thuật ngữ Git/GitHub

Tài liệu tra cứu về repository, branch, commit, đồng bộ, PR, xung đột và thao tác Git an toàn.

33 mục

Khái niệm cốt lõi

Repository

Repository

engineerdoge/math-ai-tools

Ý nghĩa

A project folder tracked by Git, usually mirrored on GitHub.

Cách dùng

When you ask to inspect a project, commit work, or compare branches, the repository is the unit being handled.

Ví dụ

engineerdoge/math-ai-tools

Ví dụ yêu cầu

Check the current repository status.

Khái niệm cốt lõi

Working tree

Working tree

git status

Ý nghĩa

The files currently checked out on your machine, including edits that are not committed yet.

Cách dùng

Use it to separate committed history from the edits currently in progress.

Ví dụ

git status

Ví dụ yêu cầu

Show what changed in the working tree.

Khái niệm cốt lõi

Staging area

Staging area

git add src/components/SiteHeader.tsx

Ý nghĩa

A temporary selection of changes that will be included in the next commit.

Cách dùng

It lets you commit only the files or hunks that belong together.

Lưu ý

Staging does not save history by itself. The commit is what records it.

Ví dụ

git add src/components/SiteHeader.tsx

Ví dụ yêu cầu

Stage only the files for the Git terms page.

Khái niệm cốt lõi

Commit

Commit

git commit -m "Add Git terms reference"

Ý nghĩa

A saved snapshot of selected changes in the repository history.

Cách dùng

Commits make it possible to review, compare, deploy, or roll back changes later.

Ví dụ

git commit -m "Add Git terms reference"

Ví dụ yêu cầu

Create a commit with a concise message.

Khái niệm cốt lõi

Diff

Diff

git diff

Ý nghĩa

A line-by-line view of what changed between two file states.

Cách dùng

Diff is the quickest way to review exactly what an edit did before committing.

Ví dụ

git diff

Ví dụ yêu cầu

Review the diff for unexpected changes.

Nhánh

Branch

Branch

qwen3.5

Ý nghĩa

A named line of work that can move separately from other lines of work.

Cách dùng

Branches let you develop a feature without changing main immediately.

Ví dụ

qwen3.5

Ví dụ yêu cầu

Tell me which branch I am currently on.

Nhánh

main branch

main branch

main

Ý nghĩa

The default branch that usually represents the stable or production-ready version.

Cách dùng

Compare your working branch with main to see what changed.

Ví dụ

main

Ví dụ yêu cầu

Compare this branch against main.

Nhánh

checkout

checkout

git switch qwen3.5

Ý nghĩa

Changing the working tree to another branch or commit.

Cách dùng

Use it when you need to inspect or continue work on another branch.

Lưu ý

Uncommitted edits can block switching branches if they would be overwritten.

Ví dụ

git switch qwen3.5

Ví dụ yêu cầu

Switch to the qwen3.5 branch after checking for uncommitted changes.

Nhánh

merge

merge

git merge main

Ý nghĩa

Combining changes from one branch into another branch.

Cách dùng

Use merge to bring main updates into your feature branch or finish a feature into main.

Lưu ý

Merge can create conflicts when both branches edited the same lines differently.

Ví dụ

git merge main

Ví dụ yêu cầu

Explain what would happen before merging main into this branch.

Nhánh

rebase

rebase

git rebase main

Ý nghĩa

Replaying commits from one branch on top of another base commit.

Cách dùng

It can make history look linear before merging a feature branch.

Lưu ý

Rebase rewrites commit history, so it should be used carefully on shared branches.

Ví dụ

git rebase main

Ví dụ yêu cầu

Do not rebase yet. First explain the risk on this branch.

Đồng bộ

clone

clone

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

Ý nghĩa

Making a local copy of a remote repository.

Cách dùng

It is usually the first step when starting work on an existing GitHub project.

Ví dụ

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

Ví dụ yêu cầu

Clone this repository and show the available branches.

Đồng bộ

remote

remote

origin git@github.com:user/project.git

Ý nghĩa

A named connection from the local repository to a repository hosted somewhere else.

Cách dùng

Remote settings decide where pull and push communicate.

Ví dụ

origin git@github.com:user/project.git

Ví dụ yêu cầu

Show the configured remotes.

Đồng bộ

fetch

fetch

git fetch origin

Ý nghĩa

Downloading remote branch information without changing your working files.

Cách dùng

Use fetch before comparing your branch with the latest remote state.

Ví dụ

git fetch origin

Ví dụ yêu cầu

Fetch from origin, then compare this branch with main.

Đồng bộ

pull

pull

git pull origin main

Ý nghĩa

Fetching remote changes and applying them to the current branch.

Cách dùng

Use it to update your local branch with work that was pushed elsewhere.

Lưu ý

Pull can change your working branch and may cause conflicts.

Ví dụ

git pull origin main

Ví dụ yêu cầu

Before pulling, check whether I have local uncommitted changes.

Đồng bộ

push

push

git push origin qwen3.5

Ý nghĩa

Uploading local commits to a remote repository.

Cách dùng

Push makes your local commits available on GitHub or another remote.

Lưu ý

Push only uploads commits, not uncommitted working tree edits.

Ví dụ

git push origin qwen3.5

Ví dụ yêu cầu

Push the current branch after confirming the build passes.

Đồng bộ

origin

origin

git push origin qwen3.5

Ý nghĩa

The conventional default name for the remote repository you cloned from.

Cách dùng

Most push, pull, and fetch examples use origin as the remote name.

Ví dụ

git push origin qwen3.5

Ví dụ yêu cầu

Check whether origin points to the expected GitHub repository.

Đánh giá

Pull Request

Pull Request

Open a PR from qwen3.5 into main

Ý nghĩa

A GitHub review page for discussing and merging branch changes.

Cách dùng

Use a PR to review changed files, run checks, discuss comments, and merge safely.

Ví dụ

Open a PR from qwen3.5 into main

Ví dụ yêu cầu

Summarize what should go into the PR description.

Đánh giá

Review

Review

Review requested changes

Ý nghĩa

Checking code changes for bugs, regressions, readability, and missing tests.

Cách dùng

Review helps catch issues before merging a branch into the shared codebase.

Ví dụ

Review requested changes

Ví dụ yêu cầu

Review this branch for bugs and missing tests.

Xung đột

Merge conflict

Merge conflict

CONFLICT (content): Merge conflict in src/app/page.tsx

Ý nghĩa

A situation where Git cannot automatically combine changes from different branches.

Cách dùng

You must choose the correct final content before the merge can continue.

Lưu ý

Do not blindly accept one side. Check the intended behavior first.

Ví dụ

CONFLICT (content): Merge conflict in src/app/page.tsx

Ví dụ yêu cầu

Explain the conflict and propose the safest resolution.

Xung đột

Conflict marker

Conflict marker

<<<<<<< HEAD

Ý nghĩa

Text markers Git inserts into a file to show conflicting versions.

Cách dùng

Markers show which part came from your current branch and which came from the incoming branch.

Lưu ý

Conflict markers should not remain in committed code.

Ví dụ

<<<<<<< HEAD

Ví dụ yêu cầu

Find any remaining conflict markers.

Xung đột

Untracked file

Untracked file

?? src/lib/git-github.ts

Ý nghĩa

A file that exists in the folder but has not been added to Git tracking yet.

Cách dùng

New pages and components usually appear as untracked until staged.

Ví dụ

?? src/lib/git-github.ts

Ví dụ yêu cầu

List untracked files and tell me which ones belong to this feature.

Xung đột

Modified file

Modified file

M src/components/SiteHeader.tsx

Ý nghĩa

A tracked file whose content differs from the last committed version.

Cách dùng

It helps you see which existing files were touched by the current work.

Ví dụ

M src/components/SiteHeader.tsx

Ví dụ yêu cầu

Show the modified files for this task.

An toàn

stash

stash

git stash push -m "before branch switch"

Ý nghĩa

Temporarily saving uncommitted changes so the working tree can become clean.

Cách dùng

Use stash before switching branches when you are not ready to commit.

Lưu ý

Stashed work can be forgotten. Always name it clearly and reapply it deliberately.

Ví dụ

git stash push -m "before branch switch"

Ví dụ yêu cầu

Stash my current edits with a clear message before switching branches.

An toàn

reset

reset

git reset --soft HEAD~1

Ý nghĩa

Moving branch or staging state back to another commit or state.

Cách dùng

Soft or mixed reset can adjust a local commit before it is shared.

Lưu ý

Hard reset can discard work. Ask for an explanation before using it.

Ví dụ

git reset --soft HEAD~1

Ví dụ yêu cầu

Explain the safest way to undo the last local commit without losing changes.

An toàn

revert

revert

git revert abc1234

Ý nghĩa

Creating a new commit that undoes an earlier commit.

Cách dùng

Revert is usually safer than rewriting history after commits have been pushed.

Ví dụ

git revert abc1234

Ví dụ yêu cầu

Revert the problematic commit without rewriting shared history.

An toàn

force push

force push

git push --force-with-lease origin qwen3.5

Ý nghĩa

Overwriting a remote branch with your local branch history.

Cách dùng

It is sometimes used after rewriting local history on a private feature branch.

Lưu ý

Force push can erase other people's remote commits. Prefer force-with-lease and confirm first.

Ví dụ

git push --force-with-lease origin qwen3.5

Ví dụ yêu cầu

Do not force push. Explain whether force-with-lease is necessary.

An toàn

.gitignore

.gitignore

.next/

Ý nghĩa

A file that tells Git which files or folders should not be tracked.

Cách dùng

Use it for build output, dependencies, local environment files, and temporary files.

Ví dụ

.next/

Ví dụ yêu cầu

Check whether build output is ignored properly.

Lệnh

git status

git status

git status --short

Ý nghĩa

A command that shows branch, staged changes, modified files, and untracked files.

Cách dùng

Run it before editing, committing, pulling, or switching branches.

Ví dụ

git status --short

Ví dụ yêu cầu

Run git status and summarize only the important changes.

Lệnh

git log

git log

git log --oneline -5

Ý nghĩa

A command for viewing commit history.

Cách dùng

Use it to find recent commits, compare work, or identify a commit to revert.

Ví dụ

git log --oneline -5

Ví dụ yêu cầu

Show the last five commits in a compact format.

Lệnh

git add

git add

git add src/lib/git-github.ts

Ý nghĩa

A command that stages changes for the next commit.

Cách dùng

Use explicit paths when you want a focused commit.

Ví dụ

git add src/lib/git-github.ts

Ví dụ yêu cầu

Stage only the files created for this page.

Lệnh

git commit

git commit

git commit -m "Add Git terms reference"

Ý nghĩa

A command that records staged changes into repository history.

Cách dùng

Use a message that says what changed and why it matters.

Ví dụ

git commit -m "Add Git terms reference"

Ví dụ yêu cầu

Commit the staged changes with a clear message.

Lệnh

git pull

git pull

git pull --ff-only

Ý nghĩa

A command that updates the current branch from a remote branch.

Cách dùng

The --ff-only option avoids creating an unexpected merge commit.

Ví dụ

git pull --ff-only

Ví dụ yêu cầu

Pull with ff-only if it is safe.

Lệnh

git push

git push

git push origin HEAD

Ý nghĩa

A command that uploads local commits to a remote branch.

Cách dùng

Use it after tests pass and commits are ready to share.

Ví dụ

git push origin HEAD

Ví dụ yêu cầu

Push this branch after confirming there are no lint or build failures.