关于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

 

上一篇:EF Code First Migrations数据库迁移


下一篇:java – Spring 3.0真的支持JSR-286吗?