# 0415 brunch and Github lidemyMentorProgram5th week1 day4 #### **brunch** :為了大型專案開發時有不同的部分開發狀態跟時間進度而分開進行分支 **git branch -v 看現在有哪些 branch git branch 接名稱 = 開一條新的 branch master 主軸版本 git branch -d 刪掉 branch git checkout branch-name 到指定的 branch 內 git merge branch-name 把指定的 branch 合併進來** 之後就可以把分支刪掉 **git branch -d** ### **conflict 檔案衝突** 當同一個檔案都被改動在不同的 brach,要合併時,電腦會困惑,就需手動決定檔案改動,vim 進去修改,再 commit -am “mesage” 增加新版本號 **Github** 多人協作的 git 平台 repository 共享倉庫 平台上的 pull requests 功能就可以在上面把 branch merge ### **如何上傳 code 到 Github** 在主頁上的選單,按下+號,選 new repository 輸入 repository name 後 可以放 code 上去 或是 從終端機上傳檔案 git remote add origin (github提供的位置) git push -u origin master push 上去後,如果有檔案修改 要先 commit 後再 push 上去,檔案才會同步 如果要 push 新的 branch 就是 先創造 branch: git branch xxx 再 git checkout xxx 進去後 push origin xxx 上去 ### **如何在上面將 brabch 合併** 在pull request 的頁面 按下 compare & pull request 按鈕 ### **如何將最新的版本拉下來** **git pull origin master** 假設拉回來電腦時遇到檔案衝突,跟上面 conflict 的處理方式一樣 然後在 push 回去 ( git push origin master ) ### **如何將有興趣的 repository 抓下來** 從 clone or download 的按鈕那邊,下載 zip 或複製位置 進終端機 輸入 git clone + 位置 如果有興趣改別人的東西,不能直接 puch 上去, 但可以使用 fork 複製到自己的 repository ### **免費的網頁空間 GitHub page** setting > GitHub pages > save master branch
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up