gpt4 book ai didi

git - Octopress - 源代码分支突然被推送到 master

转载 作者:太空狗 更新时间:2023-10-29 14:38:05 27 4
gpt4 key购买 nike

前段时间出现的问题:

$ git push origin source
To git@github.com:Loremaster/Loremaster.github.io.git
! [rejected] source -> master (fetch first)
error: failed to push some refs to 'git@github.com:Loremaster/Loremaster.github.io.git'
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.

当我推送我当前的源分支时,它突然想把它推送到 master 分支(这是错误的,我想将本地源分支推送到远程源分支)。我记得我以前没有这样的问题,但现在我有了。当我部署我的博客时,一切正常(它已部署到主服务器)但我无法更新我的源代码。解决该问题的最佳方法是什么?

这里还有git remote

$ git remote -v
octopress git://github.com/imathis/octopress.git (fetch)
octopress git://github.com/imathis/octopress.git (push)
origin git@github.com:Loremaster/Loremaster.github.io.git (fetch)
origin git@github.com:Loremaster/Loremaster.github.io.git (push)

这是 git config --get-regexp remote

$ git config --get-regexp remote
remote.octopress.url git://github.com/imathis/octopress.git
remote.octopress.fetch +refs/heads/*:refs/remotes/octopress/*
branch.source.remote origin
remote.origin.url git@github.com:Loremaster/Loremaster.github.io.git
remote.origin.fetch +refs/heads/*:refs/remotes/origin/*

$ git branch -avvv
* source 3eb4c8d [origin/master] Grammar fix.
remotes/octopress/2.5 5a6b8e4 Merge pull request #1378 from librehat/patch-1
remotes/octopress/2.5-simplify-rakefile 277f702 Move install and list tasks into separate files.
remotes/octopress/3.0 0b44a79 Merge branch '3.0' of github.com:imathis/octopress into 3.0
remotes/octopress/HEAD -> octopress/master
remotes/octopress/commander d489676 Changed config tag to use standard var names (aesthetic)
remotes/octopress/gh-pages 4381053 Fix missing 'blockquote' in example, closes #229
remotes/octopress/guard 7bdab0e Added javascript asset management and improved Rakefiles and configuration for themes and plugins. - Added Guard for file watching - Configs can be automatically reloaded - Static asset changes do not trigger Jekyll build - CommonJS modular js support proved by stich-rb - Javascript is concatenated and uglified - Environment variables toggle uglify and fingerprinting - New Jekyll plugin config_tag - New Jekyll plugin javascript_assets_tag - Added theme specific configurations - Custome Jekyll Guard to the rescue - Install, Generate, Watch, and Preview work with Guard now. - Now configs are no longer tracked by Octopress, only theme defauts are. - Console messages can be colorized. - misc config reorganization and improvements
remotes/octopress/jekyll-1-3 fc73997 Jekyll now ships with this method in Site, use it!
remotes/octopress/linklog 1750830 Merge pull request #800 from mxmerz/linklog
remotes/octopress/master 78defff Merge pull request #1443 from wickedshimmy/patch-1
remotes/octopress/migrator 9b59940 migrating 'source' and 'sass'
remotes/octopress/refactor_with_tests 8fe52e1 cucumber tests
remotes/octopress/rubygemcli 9f54cbd Add plugin-include-array to core plugins.
remotes/octopress/site 53b2df0 Merge pull request #1252 from kendaleiv/patch-1
remotes/octopress/site-2.1 98bd6c9 Merge pull request #1374 from imathis/site
remotes/origin/master 3eb4c8d Grammar fix.
remotes/origin/source 251a4d4 Small addition.

最佳答案

git remote这不是唯一的因素。
git branch -avvv将有助于查看哪个分支与 remote tracking branch 关联:它表明现在 source 关联到远程跟踪分支 origin/master 而不是 origin/source

您可以重置本地分支 source 的远程跟踪分支:

git branch -u origin/source source

参见“Make an existing Git branch track a remote branch?

然后,如果 git config push.default 设置为 simple(对于 Git 1.9+),一个简单的 git push(同时在 source 分支上 checkout )就足够了。

关于git - Octopress - 源代码分支突然被推送到 master,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27398833/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com