简体   繁体   中英

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 .

After that I went back on another branche to rebase it from master with git rebase 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. This is the first time git do that.

There is the git traces

➜  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 . I'd say the rule of thumb is: if you push something (especially using --force ) always specify the remote and branch

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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