星期五, 8月 12, 2011

git push 二三事

  • push origin
    git push可夾很多參數
    還看不太懂,好好研究一下吧
    • git push
          即git push <remote>, 如果<remote>沒設定,便push到origin
    • git push origin
         即git push origin :.
         The default behavior of this command when no is given can be configured by setting the push option of the remote.
         For example, to default to pushing only the current branch to origin use git config remote.origin.push HEAD. Any valid (like the ones in the examples below) can be configured as the default for git push origin.
    • git push origin :
           自動推到相同名稱的分支     
    • git push origin master
          將目前的master推到origin的master
      (most likely, it would find refs/heads/master), and update the same ref (e.g. refs/heads/master) in origin repository with it.      
    • git push origin HEAD
      將目前所在的branch推回origin下,同名稱的branch(
      未建立,會自動建立)
    • git push origin master:satellite/master dev:satellite/dev
           Use the source ref that matches master (e.g. refs/heads/master) to update the ref that matches satellite/master (most probably
          refs/remotes/satellite/master) in the origin repository, then do the same for dev and satellite/dev.   
    • git push origin HEAD:master
          
      HEAD為目前所在branch,也可以直接下名稱;而後面master是push到origin下的branch
    • 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.      
    • git push origin :experimental
                    Find a ref that matches experimental in the origin repository (e.g. refs/heads/experimental), and delete it.        
    • git push origin +dev:master
                    Update the origin repository’s master branch with the dev branch, allowing non-fast-forward updates. This can leave unreferenced commits dangling
                    in the origin repository. Consider the following situation, where a fast-forward is not possible:
  • push remote
    • 送給某個repo
      $ git push ssh://yourserver.com/~you/proj.git master

沒有留言: