Git工具的使用

 

  git clone https://github.com/xxx/xxaaxcc.git    (克隆分支到本地)  默认master分支; 

  git clone -b dev https://github.com/xxx/xxaaxcc.git   (克隆分支到本地)  克隆指定分支;

  git init(初始化目录)      

  git remote add origin https://github.com/xxx/xxaaxcc.git  (把https://github.com/xxx/xxaaxcc.git 这个仓库添加进来; 以后 origin就是它的本地名称)

  

(fetch具体分支)                     
  git fetch origin dev (分支名称)                     

  git push origin HEAD -u //追加新的分支到远程仓库;
  git branch (获取在哪个分支)
  git status (目前状态)
  git checkout -b dev 创建本地新的分支并到dev分支;

  //提交步骤;

   git pull
   git status
   git add --all      //git add .(所有改动的) 
   git commit -m "What you did?"
   git push

 

  //强制覆盖本地分支。

  git fetch --all

 git reset --hard origin/master // 远程分支名称

 git fetch

  最后检出:

  git checkout master

posted @ 2019-01-15 14:08  七分sunshine!  阅读(142)  评论(0编辑  收藏  举报