---
# System prepended metadata

title: Git 推送本地分支到遠端
tags: [Git]

---

# Git 推送本地分支到遠端

推送本地有但遠端沒有的分支並且關聯
`git push --set-upstream origin feature-1`
等同
`git push -u origin feature-1`

### 刪除遠程分支
`git push origin -d feature-1`

### 刪除本地分支(遠端已刪除的)
`git remote prune origin` delete local origin branch which does not existing in remote

### Clone 下來 Fork 的 Local Repo 與 Upstream 同步
#### Configure a remote for a fork
`git remote add upstream https://github.com/ORIGINAL_OWNER/ORIGINAL_REPOSITORY.git`
`git remote -v` to list current remote

#### Syncing a fork
`git pull upstream master`
`git push origin master`

###### tags: `Git`