-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Week1 #1
Conversation
> ### 建立一個叫做 wifi 的資料夾,並在裡面建立一個叫 afu.js 的檔案 | ||
|
||
依你的需求手把手告訴你怎樣做 | ||
第一種方法比較推薦,首先先載 [git](http://git-scm.com/), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
以這個案例來說,其實用不到 git
打開你的命令列介面 | ||
1. 建立一個叫做 wifi 的資料夾 | ||
輸入`mkdir wifi` | ||
2. 建立一個叫 afu.js 的檔案 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
記得先 cd wifi
2. 建立一個叫 afu.js 的檔案 | ||
- 這邊的話如果你是 mac | ||
|
||
  輸入 `mkfile afu.js` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
如果光是這樣似乎會出現 usage: mkfile [-nv] size[b|k|m|g] filename ...
提示
mkfile
如果要應用在這個案例,可能這樣示範 mkfile -n 1k afu.js
會比較好
|
||
- `git add` 決定是否加入版本控制(是否被 git 版本控制) | ||
|
||
- `git add 檔案名` 檔案加入版本控制 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
這兩個可以寫在同一個,差別在於該檔案的狀態,如果是 untracked 就是前者「決定是否加入版本控制(是否被 git 版本控制)」,反之就是後者
不過你這邊概念上是沒錯的,上述只是敘述上的建議
|
||
- `git log –oneline` 會顯示簡短的版本號 | ||
|
||
- `git checkout` 回到某個版本 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
回到某個版本或切換到某 branch
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
看到你下面有寫,沒事 XD
|
||
- `git checkout` 回到某個版本 | ||
|
||
- `git checkout master` 可以回到最新的狀態 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
master 不一定是指「最新的狀態」,在實務上,我習慣稱 master 為「穩定上線版」,這邊可以去看一下作業檢討 :)
|
||
3. `git add .` 先把所有檔案加進去版本控制,可以想像成把東西移進去資料夾 | ||
|
||
4. `git commit –am ”init” ` 建立第一個 commit,可想像成建立一個新版本(其實就是資料夾) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
如果已經先輸入了 git add .
,其實輸入 git commit -m
就好
1. 加入版本控制`git add 檔名`把東西放入資料夾 | ||
|
||
2. 新建版本`git commit` 把資料夾複製改名為版本名稱, | ||
假設改變了檔案,直接 `git commit –am”” `新建一個資料夾 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
這邊看不太懂,所以幫你改一下:
- 已經新增或改變檔案,
git add 檔名
- 將這次的改動作為一個新版本
git commit -m "Add file"
這邊要注意 git commit –am
的使用,如果你這次的修改動到三個檔案,但你只想把其中一個檔案 (假設叫做 2.js
)加入這次的更動,所以你使用了 git add 2.js
,另外兩個 1.js
和 3.js
你不想記錄,這樣 OK
但是如果這時候你使用了 git commit –am
來作結,由於 -am
同時包含了 git add .
與 git commit -m
的功能,這樣你不想動到的 1.js
和 3.js
都會被加入版控,就不是你要的了。
所以以這個例子來說,我覺得第二個奇怪的點就是用 git add 檔名
搭配 git commit –am
,還是其實你是想表示用 git add
一個一個將全部檔案加到 stage ,其實也可以啦,但這樣其實也只要輸入 git commit -m
就夠了
怕你是理解上有誤差,所以特此提醒,如果只是敘事表達上打錯,那忽略即可 :)
 打上:JavaScript 並且按下 Enter 後 : <br> | ||
 瀏覽器→作業系統→最後網路卡送出一個 request 到 google 的server → server 把搜尋的關鍵字送去 data base 儲存 → 存完後 server 再 response 到網路卡→作業系統解析完→瀏覽器顯示 html 檔給你看搜尋結果。 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
把搜尋的關鍵字送去 data base 「儲存」,這個儲存蠻有趣的,同學這邊有什麼資料可以分享嗎?
我自己的想法可能就是「搜尋」而已,至於有沒有儲存,如果假想 Google 這邊會儲存使用者的搜尋內容進行額外的分析,那也是有可能的,不過我自己沒有研究過,所以想知道同學是不是知道什麼資訊可以分享一下 XD
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
database,中間不用空格
|
||
- `git pull origin master or 你要的branch名` 把 github 從遠端抓下來 | ||
|
||
- 衝突的話一樣,`vim`進去修改存檔再`commit –am ”” `再 push 上去 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
用 vim 修衝突痛苦指數直接爆表啊 XDDDDD
不過以作業與目前學習到的來說,這題是對的
|
||
> ### Github 一個放 git repository 的地方 | ||
|
||
假設你有需要抓人家的專案或放上自己的專案。 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
如果以「抓人家的專案」為前提,感覺 git clone
與 Fork 更合適
感覺你對 git 的概念上還有點小偏誤,這邊建議先去看第一週作業檢討,看一下有沒有理解上的問題 有任何問題可以找我討論,繼續加油,如果作業想修一下也 OK |
終於上傳了,希望沒有遺漏到什麼。
麻煩助教了 ! 謝謝~