GitHub實戰系列彙總:http://www.cnblogs.com/dunitian/p/5038719.htmlhtml
——————————————————————————————————————————————————————linux
不少人問,明明有git gui 和 github能夠直接圖形化操做的嗎?所有指令幹啥???git
呃(⊙o⊙)…呃(⊙o⊙)… ===> 裝逼~github
O(∩_∩)O~,開玩笑的,其實就是爲了通用和熟悉git,linux裏面照樣這樣用,多熟悉點基礎指令頗有用的,windows
———————————————————————————————————————————————————————bash
1.把github裏面的庫克隆到指定目錄ssh
格式:git clone ssh地址 "路徑" (命令不清楚的能夠用linux查看命令的方法 git clone --help)學習
$ git clone git@github.com:dunitian/Windows10.git "F:/Work/WP/Windows10"網站
Cloning into 'F:/Work/WP/Windows10'...
remote: Counting objects: 729, done.
remote: Total 729 (delta 0), reused 0 (delta 0), pack-reused 729
Receiving objects: 100% (729/729), 5.58 MiB | 702.00 KiB/s, done.
Resolving deltas: 100% (470/470), done.
Checking connectivity... done.ui
2.切換到指定目錄[兩種方法] (windows不區分大小寫,Linux就要注意了)
方法一:命令 cd f:/work/wp/windows10 (Linux通用)
方法二:在目錄右鍵 git bash here (僅限windows)
3.查看一下狀態和日記(作完每一步均可以看看,新手多用用,每次提交的時候多用用)
DNT@DESKTOP-PTACRF6 MINGW64 /f/work/wp/windows10 (master)
$ git status
On branch master (在master分支裏面)
Your branch is up-to-date with 'origin/master'.
nothing to commit, working directory clean (沒有提交)
DNT@DESKTOP-PTACRF6 MINGW64 /f/work/wp/windows10 (master)
$ git log (提交日記)
commit 1bb5aa4761f9775d8590668115d9cf14a0148100
Author: dunitian <1054186320@qq.com>
Date: Thu Dec 10 12:14:16 2015 +0800
逆天WP-Win10開發筆記源碼(學習ing)
4.實戰一下使用status和log(添加文件)
4.1 添加一個文件 temp.dnt ==> vi temp.dnt (進入命令模式後,按i進行編輯,編輯完後按esc 再輸入 :wq)
4.2 查看一下狀態 git status ==>temp.dnt 待提交,使用 git add命令繼續跟蹤
4.3 把文件添加到暫存區 git add temp.dnt
4.4 查看一下狀態 git status ==> 一個新文件 temp.dnt,使用 git reset 能夠恢復
4.5 把文件提交到本地庫中 git commit -m "註釋"
4.6 查看一下狀態 git status ==> 沒有什麼能夠再提交了能夠使用git push 把代碼託管到 github網站上
4.7 把文件提交到github git push
4.8 查看狀態 git status ==> 提交到管理員主分支了,沒有什麼能夠提交的了
4.9 查看一下提交日記 git log
5.實戰一下使用status和log(刪除文件)
和上面差很少,我就簡寫了:
5.1 git rm temp.dnt (刪除全部:git rm -rf * [命令不理解就看看==>Linux基礎教程])
5.2 git commit -m "註釋"【推薦使用git xxx刪除或者修改,這樣就能夠直接提交,否則得加上-a選項:git commit -a -m "xx"】
5.3 git push
5.4 查看提交記錄 git log
文件木有了:
下節預告:建立分支,恢復歷史版本,消除衝突,修改提交信息,獲取遠程最新倉庫分支等