github
#看有沒有安裝過
which git
---/user/bin/git #表示以安裝git
#查看版本
git --version
#設定參數
git config --list
#設定使用者的名稱
git config --global user.name "......"
#設定使用者的email
git config --global user.email "......"
#下載 (後面接網址)
git clone https://github.com/kaochenlong/eddie-vim.git
#進入git資料夾下
cd eddie~vim/
#誰在什麼時候做了什麼事情(需要進入git資料夾下,才能看到)
git log
三大區塊:工作區、暫存區、倉庫
cd .. #回上層
mkdir gitdemo #建立一個gitdemo資料夾
cd gitdemo/
#初始化
git init
--fatal:bad default revision 'HEAD'
#看所有
ls -al
#新創檔案
touch hello.rb
touch world.rb
查看檔案位置
git status
--在工作區中,顯示為紅
#暫存區相關
git add hello.rb #單一丟入暫存區
git add --all #全部丟入暫存區
git status查看
--在暫存區中,顯示為綠
#丟回工作區
git rm --cached
#丟入倉庫 m欲顯示訊息
git commit -m "init commit"
#刪除檔案
rm hello.rb
*若是不小心刪錯檔,剛刪時的檔會在工作區,是能救回的!
git checkout hello.rb
*但必須要在存檔(入倉庫)前
查看現在身份
git branch
--master #預設主線(本尊)
#開分支(分身)
git branch member_system
#切到分支(分身)上
git checkout member_system
#切回主線master(本尊)
git checkout master
#把檔案送回master(本尊吸收分身經歷)
git merge member_system
#刪掉分支(刪除分身)
git branch -D member_system
#推上github
git remote add origin https://github.com/...
git push -u origin master
*指令錯可以重打,但若網址不小心打錯,或網址更改了,則
git remote set-url origin https://...
#分享
git push origin vote
#下載
git clone https://...
#重新上傳
git push origin master
#重新拉下來
git pull
若他人的網頁有興趣,可用
1. 去別人頁面按Fork
2. 到自己那邊,分支下面,進行修改
3. 可回推 Pull Request -->New pull request -->Create new pull request -->Create pull request
沒有留言:
張貼留言