简体   繁体   English

GIT拉其他分支后无法推动

[英]GIT Can't push after pull other branch

I was working on admin branch, but I needed some things done in develop branch, so git pull origin develop was my choice. 我当时在admin分支上工作,但是我需要在develop分支上做一些事情,所以git pull origin develop是我的选择。

After some days working (still on admin but with thoose develop things) I want to push to admin so everything gets OK. 经过几天的工作(仍然是admin但仍在develop方面),我想推送至admin以便一切正常。

I get this error ! [rejected] admin -> admin (non-fast-forward) error: failed to push some refs to 'git@git.mygit.com:mygit/mygit.git' consejo: Updates were rejected because the tip of your current branch is behind consejo: its remote counterpart. Integrate the remote changes (eg consejo: 'git pull ...') before pushing again. consejo: See the 'Note about fast-forwards' in 'git push --help' for details. 我得到这个错误! [rejected] admin -> admin (non-fast-forward) error: failed to push some refs to 'git@git.mygit.com:mygit/mygit.git' consejo: Updates were rejected because the tip of your current branch is behind consejo: its remote counterpart. Integrate the remote changes (eg consejo: 'git pull ...') before pushing again. consejo: See the 'Note about fast-forwards' in 'git push --help' for details. ! [rejected] admin -> admin (non-fast-forward) error: failed to push some refs to 'git@git.mygit.com:mygit/mygit.git' consejo: Updates were rejected because the tip of your current branch is behind consejo: its remote counterpart. Integrate the remote changes (eg consejo: 'git pull ...') before pushing again. consejo: See the 'Note about fast-forwards' in 'git push --help' for details.

If I try to do a git pull I am getting things from develop again and breaks everything I've made (I'm doing with rebase ) even if I do git pull origin admin . 如果我尝试进行git pull即使我进行git pull origin admin我也会再次从develop获取东西并破坏我所做的一切(我正在使用rebase )。

I was the only one working on admin branch, and develop one person too without touching admin 我是唯一在admin分支工作的人,并且不用接触admin develop一个人

git branch -vv

* admin   238eab7 [origin/admin: ahead 37, behind 9] Entidades remodeladas. Mapeo de entidades separadas a YAML para mejor organización Limpieza de varias cosas que sobraban (bundles y demás) Separadas las configuraciones por tipo. Separados los servicios por bundle y tipo siguiendo las recomendaciones de Symfony2
  develop 7cc5c84 [origin/develop: behind 22] Eurotax funcinoando. Quitado Memcached en el entorno de DEV para DQL y metido en PROD

If you did the pull with rebase option, you take the admin changes and put on top of develop changes(with new commits). 如果您进行了“ pull with rebase”选项,则需要进行管理员更改,然后进行开发更改(带有新提交)。 so the commits on the admin branch do not exist on your local branch anymore, it got replace by new ones. 因此,admin分支上的提交不再存在于本地分支上,它已被新的替换。 if you are shure that your changes are correct you have to push with --force option. 如果确定更改正确无误,则必须使用--force选项。 like: 喜欢:

git push --force origin admin git push --force起源管理员

When you do a pull with --rebase option, you have to use --force to replace the contents on remote repository. 使用--rebase选项进行拉取时,必须使用--force替换远程存储库中的内容。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM