1. The first change is to delete file A and delete file B cf5417235faca4c98b307eeeb45df70239c2667a
2. The second change is to restore file A 78ad43be95192bac3e16ca5bdcb8edfc1a5850c2
As a result, when PR, 2 records will appear, delete file A, delete file B, and restore file A
The desired result now is that PR will only show the record of deleting file B ee629779e2f27c54d2dcbf3a2c65df51bebefe62
How to do it?
======================
Merge submission can only merge local modifications. The key is that I have submitted it to the remote branch. Only then can the remote branch submit PR to the central library. The problem is that during RP, all records of remote modifications will be included, so that PR It will be very ugly (change record), so I want to merge the commit record of the remote branch together. (After the local branch is merged, the version number will be lower than the remote branch. There is no way to push to the remote branch. It must be pulled. In this way, the local record of the merge that was finally merged is gone again~~~)
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