簡體   English   中英

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

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

我做了一個簡單的git fetch --all --prune來從master獲取修改,然后我做了git pull

之后,我回到另一個分支,使用git rebase master從master對其進行重新設置。 在此之后,一切似乎都正常了。

但是我做了git push -f在遠處的Gitlab上發送了這個修改,git在我的rebase分支以及另一個我一個星期都沒有碰到的分支上推送了。 這是git第一次這樣做。

有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)

您對此奇怪的事情有相同的線索嗎? 我錯過/失敗了嗎

檢查您的push.default設置 我的經驗法則是:如果您推送某些內容(尤其是使用--force ),則始終指定remote和branch

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM