stringtheory
2017-02-26 11:04:35 +08:00
在 dev 分支下使用了命令:
$ git filter-branch --index-filter 'git rm --cached --ignore-unmatch main.pdf' HEAD
提示很多类似如下:
Rewrite *** (72 seconds passed, remaining 0 predicted) rm 'main.pdf'
所以应该是把各个历史上的 pdf 都删掉了。
然后$ git status
On branch dev
Your branch and 'origin/dev' have diverged,
and have 206 and 200 different commits each, respectively.
(use "git pull" to merge the remote branch into yours)
nothing to commit, working directory clean
我的理解是既然本地已经把 pdf 删了,远程 github 上就不要再 pull 回来 merge 了。于是就直接:
$ git push origin dev
To git@github.com:XXX/XXX.git
! [rejected] dev -> dev (non-fast-forward)
error: failed to push some refs to 'git@github.com:XXX/XXX.git'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
查了查说因为版本落后,所以不能直接 push ,只好强制:
$ git push -u origin dev -f
Counting objects: 1262, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (1261/1261), done.
Connection reset by 192.30.253.11340.56 MiB | 11.00 KiB/s
fatal: The remote end hung up unexpectedlyB | 11.00 KiB/s
fatal: sha1 file '<stdout>' write error: Broken pipe
error: failed to push some refs to 'git@github.com:XXX/XXX.git'
不太明白这是成功了吗,还是需要重新钥匙配对认证?