1.第一条变更是 删除A文件 删除B文件 cf5417235faca4c98b307eeeb45df70239c2667a
2.第二条变更是 恢复A文件 78ad43be95192bac3e16ca5bdcb8edfc1a5850c2
结果PR时候,就会出现2条记录,删除A文件,删除B文件,恢复A文件
现在想要的结果是 PR 只出现删除B文件的记录 ee629779e2f27c54d2dcbf3a2c65df51bebefe62
如何做到?
======================
合并提交只能做到本地修改合并,关键是我已经提交到远程分支了,远程分支才能提PR到中央库,问题点,RP的时候,会把远程修改的所有记录包含,这样PR会非常难看(change记录),所以想顺便把远程分支的提交记录也一起合并。(本地分支合并后,版本号会低于远程分支,没办法push到远程,必须pull,这样本地好不容易合并的记录,又没了~~~)
If you submit file a, numbered 1
Then submit file b, numbered 2, when you execute git reset --hard number 1, file b will also be deleted. At this time, you can still see the records of files a and b on github, but when you submit new code again, records a and b will not appear. If you only want b to appear, then you need to rewrite the code and submit it. At this time, the record of a will not appear.
Hope it helps you.
Already done. It is very important to use
git reset cf5417235faca4c98b307eeeb45df70239c2667a前一个版本号
恢复到第一次变更前的版本号,此时你的修改不会丢弃掉,然后git add ,然后git push -f
f. Force f can directly overwrite the remote submission record. The original remote submission record (change 1, change 2) will be erased.Hahaha