关于gitbashi强推覆盖的使用_

jiang@DESKTOP-A0JHUA5 MINGW64 /d/project/clms_portal (release20190714)
$ git status
On branch release20190714
Your branch is behind 'origin/release20190714' by 1 commit, and can be fast-forwarded.
  (use "git pull" to update your local branch)

Untracked files:
  (use "git add <file>..." to include in what will be committed)

        WebContent/WEB-INF/.gitignore

nothing added to commit but untracked files present (use "git add" to track)

jiang@DESKTOP-A0JHUA5 MINGW64 /d/project/clms_portal (release20190714)
$ git push -u origin release20190714 -f
Total 0 (delta 0), reused 0 (delta 0)
To http://git2.tenwa.com.cn/CebDev/clms_portal.git
 + 475b716d...e9262711 release20190714 -> release20190714 (forced update)
Branch 'release20190714' set up to track remote branch 'release20190714' from 'origin'.

jiang@DESKTOP-A0JHUA5 MINGW64 /d/project/clms_portal (release20190714)
$ git status
On branch release20190714
Your branch is up to date with 'origin/release20190714'.

Untracked files:
  (use "git add <file>..." to include in what will be committed)

        WebContent/WEB-INF/.gitignore

nothing added to commit but untracked files present (use "git add" to track)

jiang@DESKTOP-A0JHUA5 MINGW64 /d/project/clms_portal (release20190714)
$ git pull
From http://git2.tenwa.com.cn/CebDev/clms_portal
 * [new branch]        jhd20190714 -> origin/jhd20190714
Already up to date.

jiang@DESKTOP-A0JHUA5 MINGW64 /d/project/clms_portal (release20190714)
$ git checkout jhd20190714
Switched to a new branch 'jhd20190714'
Branch 'jhd20190714' set up to track remote branch 'jhd20190714' from 'origin'.

jiang@DESKTOP-A0JHUA5 MINGW64 /d/project/clms_portal (jhd20190714)
$

执行前:上述gitbash中执行强制推送覆盖远程分支。如远程分支有版本需要使用,可在强推送前先备份或clone到新分支上。这里是clone到jhd20190714分支上。

相当于,把错误提交的分支版本转移到正确的分支上了。

也可参考:https://www.jianshu.com/p/dcff86a66e9d

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值