下面的场景详细说明了远程 git repo 上错误地删除了文件的情况。如果您滚动浏览下面的提交,问题确实出现了COMMIT 4
,实际上就它是否意外/预期而言,我想知道是否有一种通用的方法来解决这个问题。最好完全避免在分支中包含不需要的文件,但是当遇到像 in 这样的情况时COMMIT 4
,我的问题是应该怎么做?
COMMIT 1 (18 days ago): created on local repo file <code1.java> on branch [code1]
and pushed to remote branch [code1] for initial commit
of the file
COMMIT 2 (14 days ago): changed a variable in the file <code1.java> on branch [code1]
and pushed to remote branch and created PR
COMMIT 3: (7 days ago): created on local repo the file <code2.java> on branch [code2]
and pushed to remote branch [code2] for initial commit
COMMIT 4: (6 days ago): **noticed that on [code2] branch I somehow had checked in
<code1.java> with commit 3** so I deleted the file <code1.java>
from branch [code2] and pushed to remote branch [code2]
and did a PR for [code2]
COMMIT 5: (5 days ago): changed formatting on file <code2.java> on branch [code2]
COMMIT 6: (4 days ago): PR reviewer accepted changes to <code1.java>
and merged branch [code1] to master
COMMIT 7: (3 days ago): PR reviewer accepted changes to <code2.java>
and merged branch [code2] to master
code1.java 现在不见了 :( :( :(