简体   繁体   English

重新修改2个分支的基准后,Git push -f

[英]Git push -f after rebase modified 2 branches

I have made a simple git fetch --all --prune to fetch modifications from master then I did git pull . 我做了一个简单的git fetch --all --prune来从master获取修改,然后我做了git pull

After that I went back on another branche to rebase it from master with git rebase master . 之后,我回到另一个分支,使用git rebase master从master对其进行重新设置。 After this everything seem work. 在此之后,一切似乎都正常了。

But went I did git push -f to send this modification on distant Gitlab, git pushed on my rebase branch and on another branch that I don't even touch since a week. 但是我做了git push -f在远处的Gitlab上发送了这个修改,git在我的rebase分支以及另一个我一个星期都没有碰到的分支上推送了。 This is the first time git do that. 这是git第一次这样做。

There is the git traces 有git痕迹

➜  n-admin git:(master) ✗ git fetch --all --prune
Fetching origin
git remote: Counting objects: 55, done.
remote: Compressing objects: 100% (54/54), done.
remote: Total 55 (delta 16), reused 0 (delta 0)
Unpacking objects: 100% (55/55), done.
From git.foo.net:foo/project
   d626c2e..928ac1b  master     -> origin/master
 + 206f658...177ea93 llb-design -> origin/llb-design  (forced update)

➜  n-admin git:(master) ✗ git pull
Updating d626c2e..928ac1b
Fast-forward
 docker-compose.override.yml.dist                             
 src/AppBundle/foo/bar.php     
 src/AppBundle/Controller/fooController.php             
 src/AppBundle/Form/DataTransformer/fooTransformer.php
 4 files changed, 72 insertions(+), 7 deletions(-)
 create mode 100644 src/AppBundle/Command/barCommand.php

➜  n-admin git:(master) ✗ git co my-branch 
Switched to branch 'my-branch'
Your branch is up-to-date with 'origin/my-branch'.

➜  n-admin git:(my-branch) ✗ git rebase master
First, rewinding head to replay your work on top of it...
Applying: foo1
Applying: foo2
Applying: foo3

➜  n-admin git:(my-branch) ✗ git push -f 
git Counting objects: 188, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (160/160), done.
Writing objects: 100% (188/188), 19.99 KiB | 0 bytes/s, done.
Total 188 (delta 143), reused 29 (delta 18)
co mremote: 
remote: View merge request for llb-design:
remote:   https://git.foo.net/foo/bar/merge_requests/494
remote: 
remote: View merge request for my-branch:
remote:   https://git.foo.net/foo/bar/merge_requests/502
remote: 
To git@git.foo.net:foo/bar.git
 + 177ea93...206f658 llb-design -> llb-design (forced update)
 + ba2a2b6...7734353 my-branch -> my-branch (forced update)

Do you have same clues about this weird thing ? 您对此奇怪的事情有相同的线索吗? Did I miss/fail something 我错过/失败了吗

Check your push.default setting . 检查您的push.default设置 I'd say the rule of thumb is: if you push something (especially using --force ) always specify the remote and branch 我的经验法则是:如果您推送某些内容(尤其是使用--force ),则始终指定remote和branch

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

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