標籤:
Android深度探索HAL與驅動開發
第三章
Git使用入門
讀書筆記
Git是對原始碼進行管理的軟體。
一、安裝Git
# apt-get install git
# apt-get install git-doc git-emall git-gui gitk
用以下命令控制Git:
# apt-get install git-core
# apt-get install git-doc git-svn git-email git-gui gitk
二、查看Git文檔
查看git-checkout命令文檔:
# git help git-checkout
查看HEML格式文檔:
# git help -w git-checkout
三、原始碼的提交與擷取
1、使用git clone命令在本地建立一個空的版本庫:
# mkdir -p/demo/helloworld-git
# cd /demo/helloworld-git
# git init
2、將檔案提交到本地版本庫:git commit
# cd /demo/helloworld-git
# echo “helloworld”>helloworld.txt
# git add helloworld.txt
# git commit -m ‘helloworld-master’
-m命令列參數是本次提交的備忘;
3、建立本地分支:git branch
# git branch 查看本地分支
# git branch new-branch 建立分支
# git branch -D new-branch 刪除剛建立的分支
4、切換本地分支:git checkout
# git checkout new-branch 將本地分支切換到new-branch上
修改helloworld.txt檔案內容並重新提交到本地版本庫
# echo ‘世界你好’>helloworld.txt
# git add helloworld.txt
# git commint -m helloworld-new-branch
5、在GitHub上建立開源項目
6、上傳原始碼到GitHub:git push
上傳前先備份
# ssh-keygen -t rsa -C “[email protected]”
上傳檔案前需要使用git config命令設定上傳這的名字和email。
# git cinfig --global user.name “Your Name”
# git config --global user.email [email protected]
使用git remove命令設定helloworld工程在GitHub上的URI。
# git remove add orign [email protected]:androidguy/helloworld.git
7、從GitHub下載原始碼:git clone
使用下命令下載整個工程
# git clone [email protected]:androidguy/helloworld.git
四、小結
五、學習Git的用法。
http://www.cnblogs.com/qwhw/
Android深度探索HAL與驅動開發 第三章