git常用

40 阅读1分钟

git常用命令

butterD.jpeg

  1. 初始化新仓库 git init
  2. 克隆代码 git clone https://gitee.com/houdunwang/hdcms.git
  3. 克隆指定分支 git clone -b dev git@gitee.com:houdunwang/hdcms.git
  4. 查看状态 git status
  5. 提交单个文件 git add index.php
  6. 提交所有文件 git add -A
  7. 使用通配符提交 git add *.js
  8. 提交到仓库中 git commit -m '提示信息'
  9. 提交已经跟踪过的文件,不需要执行 add git commit -a -m '提交信息'
  10. 删除版本库与项目目录中的文件 git rm index.php
  11. 只删除版本库中文件但保存项目目录中文件 git rm --cached index.php
  12. 修改最后一次提交 `git commit --amend
感想:
  1. 克隆指定分支 git clone -b dev 地址在项目上非常好用;
  2. 修改最后一次提交 `git commit --amend