git常用命令(一)

2020-12-27  本文已影响0人  _踮起脚尖看世界

一、新建代码库

  1. 下载一个项目和它的整个代码历史
    git clone

二、分支

  1. 列出所有分支
    git branch -a
  2. 新建一个分支,并切换到该分支
    git checkout -b [branch]
  3. 切换到指定分支
    git checkout [branch-name]
  4. 查看当前分支
    git branch

三、添加

  1. 添加指定文件到暂存区
    git add [file1] [file2] ...
  2. 添加指定目录到暂存区,包括子目录
    git add [dir]
  3. 添加当前目录所有文件到暂存区
    git add .

四、提交

  1. 提交暂存区到仓库区
    git commit -m [message]
  2. 提交暂存区指定文件到仓库区
    git commit [file1] [file2] ... -m [message]
上一篇 下一篇

猜你喜欢

热点阅读