關卡內容:
在本機上 Merge 你的 branch,刪除舊的 branch,從 upstream 獲得更新來獲得最終勝利!
步驟:從本機 Merge
你的 pull request 已經被 merged 了!現在來把 forked 和原始的 repository 做個同步吧!因為你的 branch 內容順序正確,現在只要把你的 branch merge 進主要的 branch('gh-pages')就可以了哦。
首先,切換到想要 merge 進去的 branch,也就是 'gh-pages'。
$ git checkout gh-pages
告訴 Git 你想要 merge 那個 branch 進來,也就是你的 feature branch,名字是 'add-username'。
$ git merge <BRANCHNAME>
整理一下吧,現在把剛剛已經 merged 的 feature branch 刪掉。
$ git branch -D <BRANCHNAME>
也可以把 branch 從 GitHub 上的 forked repository 中刪除哦:
$ git push <REMOTENAME> --delete <BRANCHNAME>
步驟: 從 Upstream Pull
最後一步,但也是很重要的一步,若從原專案(現在首頁已經有你的名字了哦)pull 回來,你也會有一個相同的網頁,位置在 yourusername.github.io/patchwork。
從原本的 upstream pull 回來:
$ git pull upstream gh-pages
恭喜恭喜!
你在本機建立了 repositories,與一名 collaborator 協作、push、pull,加入了百萬開發者所處的開源世界,是你,豐富了開源世界!
去 jlord.github.io/patchwork 這裡看,你的名字已經被收錄進來了呢!
確認你完成了所有步驟:
git-it verify
前往下一關:
git-it
撇步
- Merge branch 到目前的 branch
$ git merge <BRANCHNAME>
- 切換正在工作的 branch
$ git checkout <BRANCHNAME>
- 刪除本機的 branch
$ git branch -D <BRANCHNAME>
- 刪除 remote branch
$ git push <REMOTENAME> --delete <BRANCHNAME>
- 從 remote branch Pull
$ git pull <REMOTENAME> <BRANCHNAME>