git的push與fetch

1、push
首次:

git push -u origin master

日常:

$ git push origin master

2、fetch

$ git remote -v                    // 查看遠程分支
$ git fetch origin master:temp     // 從遠程獲取最新版本到本地
$ git diff temp                    // 比較本地倉庫與下載的temp分支
$ git merge temp                   // 合併temp分支到本地的master分支
$ git branch -d temp               // 刪除分支

3、放棄本地修改 強制更新

$ git fetch --all
$ git reset --hard origin/master

git 備忘:
1、有關遠程庫

$ ssh-keygen -t rsa -C "[email protected]"     // 新機創建ssh --id_rsa.pub
$ git remote add origin git@github.com:annyao/repo.git // 關聯遠程庫
$ git clone git@github.com:annyao/repo.git

2、其他
https://www.liaoxuefeng.com/wiki/

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章