git 版本管理工具說明

         

  1. $ git init                  (初始化本地倉庫,會生成.git 文件夾  .git 文件夾裏存儲了全部的版本信息、標記等內容)
  2. $ git add .               (從本地倉庫增刪,結果將會保存到本機的緩存裏面)
  3. $ git commit -m " 第  次提交 "   (提交,把本機緩存中的內容提交到本機的 HEAD 裏面)
  4. $ git remote add origin  http:\\.......  (把本地倉庫和遠程倉庫關聯起來。若是不執行這個命令的話,每次 push 的時候都須要指定遠程服務器的地址)
  5. $ git push origin master                    (把本地master分支的最新修改推送至遠端 (如GitHub))
  6. $ git pull origin master                 (將遠端倉庫pull最新代碼)
  7. Username for 'https://github.com': yjlgithup
    To https://github.com/yjlgithup/bu.git
     ! [rejected]        master -> master (non-fast-forward)
    error: failed to push some refs to 'https://github.com/yjlgithup/bu.git'
    hint: Updates were rejected because the tip of your current branch is behind
    hint: its remote counterpart. Integrate the remote changes (e.g.
    hint: 'git pull ...') before pushing again.
    hint: See the 'Note about fast-forwards' in 'git push --help' for details.

    若是出錯:git pull --rebase origin mastergit

 提交代碼到遠程分支github

  1.git checkout -b ' two '  (切換並建立一個分支)緩存

  2.git add .    (提交分支代碼)服務器

  3.git commit -m ''   (提交 修改信息)學習

  4.git remote add origin http://....  (鏈接遠程倉庫)fetch

  5.git pull origin master  (從新拉一邊代碼)spa

  6.git push origin  two   (提交分支代碼)code

githup 上面會出現你心建立的分支,而且提交的代碼blog

 

拉取分支代碼到本地教程

當我想從遠程拉取到一條本地不存在的分支 代碼

  1.git init (初始化)

  2.git remote add origin http://....   (鏈接遠程倉庫)

  3.git clone (首次拉取代碼)

  4.git pull origin master

  5.git fetch  

  6.git checkout -b (本地分支名稱 two )origin/(遠程分支名稱 two)

推薦學習資料:

  廖雪峯的官方教程Git  http://www.liaoxuefeng.com/wiki/Git

相關文章
相關標籤/搜索