[关闭]
@StrGlee 2018-06-28T15:42:28.000000Z 字数 427 阅读 780

git 使用

git


  1. git clone git@***/test.git # 克隆远程分支到本地, 默认进入master分支
  2. git checkout -b test_a # 从当前分支(master)切出新分支 test_a 用于自己开发

提交新文件到远程仓库

  1. git add <需要提交的文件>
  2. git commit -m'本次提交的描述' # 提交到本地仓库
  3. git push # 提交到远程仓库

test_a分支合并master分支的代码

  1. git fetch # 从远程仓库拉取代码
  2. git merge master # 合并远程master分支
  3. git push # 提交到远程仓库

如果有冲突 :

  1. git diff <冲突文件名> ,然后解决冲突
  2. git add <冲突文件名>
  3. git commit -m'本次解决冲突的描述'
  4. git push # 提交到远程仓库

撤回代码

  1. git checkout <文件名> # 把工作区代码还原到上次commit时候的代码
  1. git reset <文件名> # 把暂存区文件(git add添加的文件)撤回到工作区
添加新批注
在作者公开此批注前,只有你和作者可见。
回复批注