Git的命令在命令行下使用有时候会记不住,写这个东西来帮助自己记忆;
| 命令 | 作用 |
|---|---|
| git add filename | 增加名为filename的文件到当前分支 |
| git commit -m "string" | 以string为description来提交一次修改 |
| git branch branchname | 新增一个branchname的分支 |
| git switch branchname | 切换到branchname的分支 |
| git status | 查看当前git状态 |
| git checkout -- filename | 还原暂存区对于filename的修改 |
| git reset --hard submitcode | 把当前版本回退到submitcode |
| git rm filename | 在当前版本删除filename的文件 |
| git push origin | 把当前commit推送到远程 |
| git clone origin | 克隆远程版本库 |
| git chekout branchname | 切换分支到branchname(注意这里没有--) |
| git merge branchname | 合并branchname分支到当前分支 |
| git stash | 暂存当前修改,清空修改区 |
| git cherry-pick submitcode | 复制submitocde的修改到当前的分支 |
| git tag tagname submitcode | 把tagname标签打在submitcode上面(-d 删除) |
| git log | 查看git历史操作记录 |
| git reflog | 查看reference记录 |
| git remote -v | 显示远程仓库地址 |
| git pull | 抓取当前分支对应的远程分支 |
Comments NOTHING