Ish*_*lor 6 git github git-bash
git和github的新功能.
我想在本地和远程替换master我的其他分支的git 分支bridge.问题是git无法解析bridge分支的引用.问题来自推向github.
git树是如何形成的:
为了规避,我创建了另一个名为bridge的分支.我不喜欢我已将网桥设为默认设置,因此我尝试将其更改为主设备使用:
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
它在当地工作.但是,当我试图推动时,我得到以下内容:
NAME@**** /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 git@github.com: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 'git@github.com: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.
NAME@**** /C/Users/NAME/Documents/GitHub/tabtrack (master) $ git push origin master Enter passphrase for key '/c/Users/NAME/.ssh/id_rsa': To git@github.com:NAMEtaylor/tabtrack.git ! [rejected] master -> master (non-fast-forward) error: failed to push some refs to 'git@github.com: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.
NAME@**** /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但是:
NAME@**** /C/Users/NAME/Documents/GitHub/tabtrack (bridge) $ git checkout master Switched to branch 'master' NAME@**** /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 git@github.com:NAMEtaylor/tabtrack.git
最后,我尝试git push origin bridge --verbose按照一些stackoverflow问题的建议:
$ git push origin bridge --verbose Pushing to git@github.com:ishaantaylor/tabtrack.git Enter passphrase for key '/c/Users/Ishaan/.ssh/id_rsa': To git@github.com: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树的屏幕截图(我需要更多的代表来发布功能图片):http: //i.imgur.com/FN9wHdi.jpg
如果我需要在问题中添加任何其他信息以便它变得更好,请告诉我.非常感谢您的时间,即使您只是阅读我的问题!
首先设置默认推送策略:
git config --global push.default simple
Run Code Online (Sandbox Code Playgroud)
然后你可以尝试推送你的 master 分支
git push -u -f origin master
Run Code Online (Sandbox Code Playgroud)
(您不需要桥接分支,因为您已将 master 合并到其中,并在第 4 点将该分支合并回 master)