merge a git branch into master

git 開分支很快,透過 git branch 就可以了,切換 local 和 server 上的  branch 是使用 git checkout, 有分支總有一天會需要匯回master, 合併的指令如下:

git checkout master
git pull origin master
git merge test
git push origin master

If I have a local branch from a remote one, I don’t feel comfortable with merging other branches than this one with the remote. Also I would not push my changes, until I’m happy with what I want to push and also I wouldn’t push things at all, that are only for me and my local repository. In your description it seems, that test is only for you? So no reason to publish it.

git always tries to respect yours and others changes, and so will --rebase. I don’t think I can explain it appropriately, so have a look at the Git book – Rebasing or git-ready: Intro into rebasingfor a little description. It’s a quite cool feature




Git 分支 – 分支的新建與合併


How do I update a GitHub forked repository? 同步分出來的分支