git-operations-rules

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Git Operations Rules

Git操作规则

Rule (CRITICAL)

规则(CRITICAL)

These rules MUST ALWAYS be followed when performing git operations.
在执行Git操作时,必须始终遵循以下规则。

git unstage

git unstage

Use
git unstage
to reset the staging area. Do not pass any options.
bash
git unstage
使用
git unstage
重置暂存区,请勿添加任何选项。
bash
git unstage

git undo

git undo

Use
git undo
to undo the last commit. Do not pass any options.
bash
git undo
使用
git undo
撤销最后一次提交,请勿添加任何选项。
bash
git undo

git stash

git stash

Do not use shorthand. Use explicit commands:
  • To save changes:
    git stash push
    (not
    git stash
    )
  • To restore:
    git stash apply
    (not
    git stash pop
    )
Before stashing, stage any new (untracked) files with
git add
so they are tracked; otherwise they will not be included in the stash.
bash
git add <new-files>
git stash push -m "<message>" -- <paths>
请勿使用简写命令,请使用显式命令:
  • 保存变更:
    git stash push
    (而非
    git stash
  • 恢复变更:
    git stash apply
    (而非
    git stash pop
在执行暂存前,请使用
git add
将所有新的(未跟踪)文件加入暂存区,使其被Git跟踪;否则这些文件不会被包含在暂存快照中。
bash
git add <new-files>
git stash push -m "<message>" -- <paths>

Related Skills

相关技能

  • git-commit - Use when creating git commits
  • file-deletion-rules - Use when deleting files
  • git-commit - 创建Git提交时使用
  • file-deletion-rules - 删除文件时使用