git push的一般形式: git push <遠程主機名> <本地分支名> <遠程分支名>
操作過程
1 修改代碼並提交本地
git add 修改文件
git commit -m "提交信息" ------ 將修改從暫存區提交到本地版本庫
2 推送到遠端特定分支nsdl-3.0
git push origin HEAD:nsdl-3.0
備注:
git push origin HEAD:refs/for/nsdl-3.0 推送到遠端nsdl-3.0分支的臨時分支中,refs/for 的意義在於推送代碼經過code review后才merge到nsdl-3.0分支中,而refs/heads不需要
典型的兩種用法如下,其他可通過git push ---help進行查詢
git push origin HEAD:master Push the current branch to the remote ref matching master in the origin repository. This form is convenient to push the current branch without thinking about its local name. git push origin master:refs/heads/experimental Create the branch experimental in the origin repository by copying the current master branch. This form is only needed to create a new branch or tag in the remote repository when the local name and the remote name are different; otherwise, the ref name on its own will work.