2016年8月15日 星期一

[學習] Git

依照保哥的

30 天精通 Git 版本控管

http://blog.miniasp.com/post/2013/11/03/Learning-Git-Part-2-Master-Git-in-30-days.aspx

目前做到Git 版本控管 (03):建立儲存庫 ( Repository )
學習到幾個git shell指令:
* git init            建立本機的儲存庫
* git init --bare         建立本機的共用儲存庫(多人共用電腦使用)
* git clone [REPOSITORY_URI] 複製本機或遠端(ex: GitHub)的儲存庫到本機(要先到複製目的地的位址)

其他指令學習:
* mkdir datafile_name     建立資料夾
* cd ..            回到上一層
* cd .\otherfile_name     進入這一層下的otherfile_name資料夾
* dir             查看目前目錄
* dir .git           查看儲存庫

Git 版本控管 (04)
* git init          建立本機端儲存庫
* git add .         告知Git這些檔案將被加入Git版本庫(會將此工作目錄下所有的檔案加入這個Git工作目錄的[索引]或[快取]之中)
* git add app/*       加入app目錄底下所以檔案
* git add *.txt        加入所有.txt檔
* git status         查看目前工作目錄的詳細狀態
* git status -s        同上,精簡版
* git commit        建立版本,會打開記事本,自己加上版本的說明,儲存
* git commit -m "版本紀錄的說明文字"
* git log          查歷史紀錄
* git log -10        查10筆歷史紀錄
* git rm '*.txt'        刪除所有.txt檔
* git rm 'app/*.html'
* git mv 'oldname' 'newname' 將oldname改名為newname
* git reset          
* git reset --hard       全部復原到上一版本
* git checkout master 'filename' 復原單筆檔案filename到上一版本

沒有留言:

張貼留言