LoginSignup
0
0

More than 5 years have passed since last update.

用 Git 把本地的非 master 分支推到遠端的 master 分支

Posted at

假如我現在有個 develop 的分支在本地端,我想要把 develop 分支上的變更推到遠端的 master 分之上,這樣就好:

git push origin develop:master

格式

git push <remote> <local branch name>:<remote branch to push into>

進階

不指定 branch ,只要 push 當前的位置就好

的話,就只要把 local branch 換成 HEAD 即可:

git push origin HEAD:master

注意!

在冒號前面不打東西的話,就會把遠端上的 branch 刪掉,所以操作上要小心:

git push origin :master

就會跳出像下面的訊息:

To git@github.com:vc7/something.git
 - [deleted]         master

就會把遠端的 master 這個 branch 刪掉了

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0