-
git init-> 在任何文件夹/存储库中初始化 git(仅当您不克隆存储库时才需要)
-
git clone https://github.com/<your-user-name>/<repo-name>-> 在本地系统中克隆存储库。
-
git status-> 显示存储库的当前状态。
-
git add <file-name>-> 将特定文件添加到暂存区
-
git diff / git whatchanged-> 提供存储库中最近的更改
-
git add .-> 将所有更改的文件添加到暂存区
-
git commit -m "<your-message>"-> 向当前文件发送一条消息并将其快照提交到历史记录
-
git log-> 显示提交历史
-
git revert <commit-token>-> 丢弃特定的提交(删除已提交的文件但保留历史记录)
-
git reset --soft HEAD~<no-of-commits-to-revert>-> 撤消提交并将更改带回暂存区
-
git restore --staged <file>-> 将添加到暂存区的更改部分中的特定文件带回。
-
git remote -v-> 显示所有远程连接
-
git remote add origin https://github.com/<your-user-name>/<repo-name>-> 将你的分叉分支添加为原点(如果仓库被克隆,则无需执行此操作)
-
git remote add upstream https://github.com/<parent-user-name>/<repo-name>-> 将父存储库添加为上游。
-
git pull origin-> 将原点所做的更改提取到本地系统
-
git pull upstream-> 将原点所做的更改提取到本地系统
-
git branch <branch-name>-> 使用 branch-name 创建分支
-
git checkout <branch-name>-> 现在您可以在指定的分支中进行更改
-
git checkout -b <branch-name>git branch <branch-name>-> 这是和的组合git checkout <branch-name>
-
git merge <branch-name>-> 将其子分支名称合并到其父分支中。
-
git branch -d <branch-name>-> 删除指定分支。如果分支名称中的更改尚未合并到父分支,则这些更改将被删除。
-
git push origin <branch-name>-> 将最近的提交推送到新分支