Git命令大全
基础命令
git init:初始化一个Git仓库git add <file>:将文件添加到暂存区git commit -m "<message>":提交暂存区的文件到本地仓库git status:查看工作区、暂存区、本地仓库的状态git log:查看提交历史git diff:查看工作区和暂存区的差异
分支管理
git branch:查看本地分支git branch <branch-name>:创建新分支git checkout <branch-name>:切换分支git merge <branch-name>:合并指定分支到当前分支git branch -d <branch-name>:删除指定分支
远程仓库
git remote add <remote-name> <remote-url>:添加远程仓库git push <remote-name> <branch-name>:将本地仓库的指定分支推送到远程仓库git pull <remote-name> <branch-name>:将远程仓库的指定分支拉取到本地仓库git clone <remote-url>:克隆远程仓库到本地
其他命令
git stash:将当前工作区的修改暂存起来git tag <tag-name>:打标签git reset <commit>:回退到指定的提交git revert <commit>:撤销指定的提交
本作品采用 知识共享署名-相同方式共享 4.0 国际许可协议 进行许可。