Git 命令使用总结

  • git init: 在当前目录创建一个新的空Git仓库。
  • git clone [url]: 从远程仓库克隆一个项目到本地。
  • git add [file]: 将文件添加到暂存区。
  • git commit -m “message”: 提交暂存区的文件到本地仓库,并添加一条提交信息。
  • git status: 查看当前工作区的状态(已修改、已暂存等)。
  • git diff: 查看工作区与暂存区的差异。
  • git diff [commit1] [commit2]: 查看两个提交之间的差异。
  • git log: 查看提交历史。
  • git branch [branch]: 创建一个新的分支。
  • git checkout [branch]: 切换到指定分支。
  • git merge [branch]: 将指定分支合并到当前分支。
  • git remote add [name] [url]: 添加一个远程仓库。
  • git push [remote] [branch]: 将本地仓库的提交推送到远程仓库。
  • git pull [remote] [branch]: 从远程仓库拉取最新提交。
  • git stash: 将当前工作区的修改保存到一个临时区域。
  • git reset [commit]: 回退到指定的提交。
  • git rm [file]: 从Git仓库中删除文件。
  • git tag [name]: 创建一个标签。
  • git show [tag]: 查看指定标签的详细信息。
    20
  • List item

. git config: 设置和查看Git配置信息。

你可能感兴趣的:(总结,git)