Try   HackMD

Git 專案開發前-初始設定

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

圖片引用自w3c.hexschool

0_Git 最初始設定

// 查詢git版本,以確定安裝成功
git --version

// 設定個人識別資料
git config --global user.name "您的姓名"
git config --global user.email "您的Email"

// 查詢識別資料
git config --list

// 檢視特定的值
git config user.name

1_完整複製他人專案到自己電腦

// 若mac可能走SSH,需產生金鑰
git clone https://

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →


2_在本機建立與切換branch

// 在本機新建立分支
git branch <分支名稱>

// 查看本機所有的分支,以確認branch成功建立
git branch

3_將所做異動add至暫存區,並commit至本機數據庫

// 將全部檔案加入暫存區
git add .
或 git add --all

// 查詢當前檔案狀態;如果是最新狀態,會顯示working tree clean
git status

// 提交檔案到本地儲存庫
git commit -m "註解"

// 查詢commit紀錄
git log 

4_設定upstream(上游)

// 將本機的分支新增到Github
git push

// git跳錯誤提示。告知遠端Github沒有相對應名稱的分支,須在push的同時,於遠端Github也新增一個同名的分支作為upstream

// 複製git給的指令,貼上並執行
git push --set-upstream origin 分支名稱

// 查詢遠端Github所有分支,以確保upstream設定成功
git branch -r
tags: frontend git Back to Front End Homepage
Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →