簡體   English   中英

檢查推送是否在主服務器或分支服務器上— Github

[英]Checking if the push was on master or branch — Github

我剛剛發布了有關Github的更新。 成功了 當我檢查Github時,它沒有顯示。 如何檢查Github推送在主服務器上還是在我的叉子上?

更新:我無權編寫或推送主版。 當我檢查master分支時,創建了一個新分支,並將我的代碼推送到該分支中。 現在,如果我要推送任何內容,它將去分支而不是我的分支存儲庫。 如何克服呢?

你可以試試:

git remote show origin

那將顯示遠程的“ HEAD branch ”:

C:\Users\VonC\prog\git\git>git remote show origin
* remote origin
  Fetch URL: https://VonC@github.com/VonC/git
  Push  URL: https://VonC@github.com/VonC/git
  HEAD branch: master                            <<==============
  Remote branches:
    maint  tracked
    master tracked
    next   tracked
    pu     tracked
    todo   tracked
  Local refs configured for 'git push':
    master forces to master (up to date)
    next   forces to next   (up to date)

但是,這不是一個確定的答案,因為您可以看到:

  Fetch URL: https://github.com/git/git
  Push  URL: https://github.com/git/git
  HEAD branch (remote HEAD is ambiguous, may be one of the following):
    maint
    master

在這種情況下,您需要轉到GitHub存儲庫本身,並查看已設置的默認分支


關於您的推送,請檢查:

  • git status (查看您是在分支還是在DETACHED HEAD中
  • git branch -avvv (查看哪個分支應該推送到哪里)

聽起來您不小心創建了另一個分支,並且每個分支都有唯一的提交。

您可以從不需要的分支中獲取代碼,然后將其與“好”分支合並。 這是一個非常有趣的簡單教程,其中包含圖片並且是交互式的。 它會確切地告訴您您需要做什么。

http://pcottle.github.io/learnGitBranching/

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM