6
git和github的新手。合併分支後無法解析reference refs/refs/remotes/origin/branch
我想用本地和遠程的我的其他分支bridge
替換git master
分支。問題是git無法解析bridge
分支的引用。問題出在推送到github上。
git的樹怎麼走過來的是這樣的:
- 通過Git的GUI啓動主分支。
- 繼續,然後意識到這並不是很好,並過渡到Bash。
- 由於本地主分支的尖端位於遠程對象的尖端後面,因此無法再推送給github以作爲master。
爲了規避,我創建了另一個叫做橋的分支。我不喜歡,我做了橋默認的,所以我又試圖用改回主:
git checkout better_branch git merge --strategy=ours master # keep the content of this branch, but record a merge git checkout master git merge better_branch # fast-forward master up to the merge
在本地工作。然而,當我試圖將我得到了以下內容:
[email protected]**** /C/Users/NAME/Documents/GitHub/tabtrack (master) $ git push warning: push.default is unset; its implicit value is changing in Git 2.0 from 'matching' to 'simple'. To squelch this message and maintain the current behavior after the default changes, use: git config --global push.default matching To squelch this message and adopt the new behavior now, use: git config --global push.default simple See 'git help config' and search for 'push.default' for further information. (the 'simple' mode was introduced in Git 1.7.11. Use the similar mode 'current' instead of 'simple' if you sometimes use older versions of Git) Enter passphrase for key '/c/Users/NAME/.ssh/id_rsa': To [email protected]:NAMEtaylor/tabtrack.git ! [rejected] master -> master (non-fast-forward) error: unable to resolve reference refs/remotes/origin/bridge: No error error: Cannot lock the ref 'refs/remotes/origin/bridge'. error: failed to push some refs to '[email protected]:NAMEtaylor/tabtrack.git' hint: Updates were rejected because the tip of your current branch is behind hint: its remote counterpart. Integrate the remote changes (e.g. hint: 'git pull ...') before pushing again. hint: See the 'Note about fast-forwards' in 'git push --help' for details.
[email protected]**** /C/Users/NAME/Documents/GitHub/tabtrack (master) $ git push origin master Enter passphrase for key '/c/Users/NAME/.ssh/id_rsa': To [email protected]:NAMEtaylor/tabtrack.git ! [rejected] master -> master (non-fast-forward) error: failed to push some refs to '[email protected]:NAMEtaylor/tabtrack.git' hint: Updates were rejected because the tip of your current branch is behind hint: its remote counterpart. Integrate the remote changes (e.g. hint: 'git pull ...') before pushing again. hint: See the 'Note about fast-forwards' in 'git push --help' for details.
[email protected]**** /C/Users/NAME/Documents/GitHub/tabtrack (master) $ git push origin bridge Enter passphrase for key '/c/Users/NAME/.ssh/id_rsa': error: unable to resolve reference refs/remotes/origin/bridge: No error error: Cannot lock the ref 'refs/remotes/origin/bridge'. Everything up-to-date
我試圖
git push -f
但:[email protected]**** /C/Users/NAME/Documents/GitHub/tabtrack (bridge) $ git checkout master Switched to branch 'master' [email protected]**** /C/Users/NAME/Documents/GitHub/tabtrack (master) $ git push -f warning: push.default is unset; its implicit value is changing in Git 2.0 from 'matching' to 'simple'. To squelch this message and maintain the current behavior after the default changes, use: git config --global push.default matching To squelch this message and adopt the new behavior now, use: git config --global push.default simple See 'git help config' and search for 'push.default' for further information. (the 'simple' mode was introduced in Git 1.7.11. Use the similar mode 'current' instead of 'simple' if you sometimes use older versions of Git) Enter passphrase for key '/c/Users/NAME/.ssh/id_rsa': Counting objects: 13, done. Delta compression using up to 2 threads. Compressing objects: 100% (7/7), done. Writing objects: 100% (7/7), 898 bytes | 0 bytes/s, done. Total 7 (delta 5), reused 0 (delta 0) To [email protected]:NAMEtaylor/tabtrack.git
- 1297c9f...bfa60d5 master -> master (forced update) error: unable to resolve reference refs/remotes/origin/bridge: No such file or d irectory error: Cannot lock the ref 'refs/remotes/origin/bridge'.
最後,我想
git push origin bridge --verbose
按照建議的一些stackoverflow問題:$ git push origin bridge --verbose Pushing to [email protected]:ishaantaylor/tabtrack.git Enter passphrase for key '/c/Users/Ishaan/.ssh/id_rsa': To [email protected]:ishaantaylor/tabtrack.git = [up to date] bridge -> bridge updating local tracking ref 'refs/remotes/origin/bridge' error: unable to resolve reference refs/remotes/origin/bridge: No error error: Cannot lock the ref 'refs/remotes/origin/bridge'. Everything up-to-date
我的git樹的屏幕截圖是通過點擊下面的鏈接顯示
(我需要更多的代表來發布功能PIC): http://i.imgur.com/FN9wHdi.jpg
請讓我知道如果我需要的任何其他信息在加問題變得更好。非常感謝您的時間,即使您只是閱讀我的問題!
非常感謝你的迴應! 「分支機構主設置爲從原點跟蹤遠程分支機構主機。所有內容都是[至今] 爲什麼這是解決方案,它是如何解決問題的? –
@IshaanTaylor它允許您建立本地分支和遠程跟蹤之間的跟蹤關係,這意味着Git知道要推送什麼以及在哪裏推送。你可以在http://stackoverflow.com/a/17096880/6309看到更多 – VonC