[TOC]
## Merge Tada - Merge和刪除branches

在本機上 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 <BRANCH_NAME>
```
整理一下吧,現在把剛剛已經 merged 的 feature branch 刪掉。
```
$ git branch -d <BRANCH_NAME>
```
也可以把 分支branch 從GitHub 上的 forked repository 中刪除哦:
```
$ git push <REMOTE_NAME> --delete <BRANCH_NAME>
```
### 步驟: 從 Upstream Pull
最后一步,但也是很重要的一步,若從原項目(現在首頁已經有你的名字了哦)收取pull回來,你也會有一個相同的網頁,位置在yourusername.github.io/patchwork。
從原本的 upstream pull 回來:
```
$ git pull upstream gh-pages
```
### 恭喜恭喜!
你在本機建立了 repositories,與一名 伙伴 collaborator 協作、推送push、拉取pull,加入了百萬開發者所處的開源世界,是你,豐富了開源世界!
去[jlord.github.io/patchwork](https://jlord.github.io/patchwork) 這里看,你的名字已經被收錄進來了呢!
### Tips
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>
```
- 介紹
- 1. Get Git - 安裝并且設置Git
- 2. Repository - 建立一個本地的repository
- 3. Commit to it - 檢查狀態、新增或修改commits
- 4. GitHubbin - 注冊GitHub帳號
- 5. Remote Control - 將repository做本地和遠程的連接
- 6. Forks and Clones - Fork和clone一個開源的計劃
- 7. Branches aren't just for Birds - 建立一個feature branch
- Git分支開發模型
- 8. It's a Small World - 邀請并和別人合作
- 9. Pull, Never Out of Date - 利用Push和pull來和GitHub.com同步
- 10. Requesting You Pull Please - 建立一個pull request
- 11. Merge Tada - Merge和刪除branches
- 學會 GitHub
- GitHub 使用指南
- git 與 github 模板配置
- GitHub Actions
- 實用技巧
- Git Flow
- Submodule子模塊
- 工作記錄
- 常用命令
- 幫助
- 資源
- 解疑答惑