git 操做相關

1、git從遠程服務器更新本地代碼git

一、git fetch origin master:temp  //將遠程服務器master分支的獲取下來,並存入本地的temp分支github

二、git diff temp  //查看本地與temp分支的差異 (git diff origin/master比較本地與遠程服務器master分支的差異)服務器

三、git merge temp  //將本地master分支與temp分支合併app

四、git branch -D temp  //刪除本地的temp分支  (git branch -a查看本地與遠程服務器上的全部分支)fetch

2、添加遠程庫。教程

一、git remote add origin git@github.com:cp-apple/learngVue.gitrem

二、git push -u origin master   //第一次後能夠直接git push文檔

參考連接:廖雪峯老師的git教程之添加遠程庫get

可能碰見的小問題:it

a.  error:src refspec master does not match any.

緣由分析:引發該錯誤的緣由是,目錄中沒有文件,空目錄是不能提交上去的

解決方案:

touch readme.txt
git add readme.txt 
git commit -m 'first commit'
git push origin master

b. not a git repository.

解決方案:git init.

3、克隆遠程庫。

一、git clone git@github.com:cp-apple/learningVue.git

4、操做相關。

git add -h 查看git add 命令的幫助文檔。

相關文章
相關標籤/搜索