git 的簡單使用

1. git 的設置
   $ git config --global user.name "Your Name"
   $ git config --global user.email "[email protected]"

2. 創建心倉庫
   git init

3.   創建一個本地倉庫的克隆版

       git clone /path/to/repository  (/path/to/repository 要克隆的倉庫路徑)


4.   創建一個遠端服務器倉庫的克隆版

      git clone username@host:/path/to/repository

      (如 : git clone git://github.com/username/OS.git) 


5.  添加、提交

      git add  <filename> (添加到本地緩存區)

      git commit  -m "提交信息"  (提交到head (本地倉庫))

      git remote add origin <server> (將你的倉庫連接到某個遠程服務器)

      (如 : git  remote add origin  https://github.com/username/OS.git)

      git  push origin  master (推送到遠端服務器)


6.  刪除

     首先用git status命令查看下狀態。

     用git pull更新代碼,確保代碼是庫上最新代碼,防止覆蓋其他人的提交。

     用git add arch/arm/mach-msm/board-xxx.c把修改後的文件加入到緩衝區。

     用git commit提交入庫到本地服務器中,這一步會加入註釋。

     用git log命令查看已提交的修改,是否正確。

     用git push命令把本地服務器上的內容更新到遠程服務器上。

發佈了65 篇原創文章 · 獲贊 9 · 訪問量 7萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章