Git Commands
Git Commands 基本操作 Command Explanation git config --global user.name "" 设置用户姓名 git config --global user.email "" 设置用户邮箱 git init 在当前目录创建仓库 git clone 将远程的仓库克隆到本地 git add . 将当前目录下的所有代码添加到暂存区 git commit -m "" 提交暂存区内容,并设置注释 比对 Command Explanation git diff 比对当下的内容和暂存区内容,显示差别 git diff HEAD 比对当下的内容和最近一次提交的内容,显示差别 git diff HEAD^ 比对当下的内容和倒数第二次提交的内容,显示差别 git diff HEAD^ HEAD 比对最近两次提交,显示区别 历史 Command Explanation git log 打印提交历史 git log --oneline 打印为单行 git log --all 打印所有记录 git log --graph 打印历史示意图 分支 Command Explanation git branch [分支] 无分支,创建分支;有分支,打印所有的分支 git checkout 切换至分支 git checkout -b 创建并切换至该分支