The scenario below details where there was a deleted file on a remote git repo mistakenly. If you scroll through the commits below, the problem really came up in COMMIT 4
and actually in terms of whether it was unexpected/expected, I wonder if there is a common way to remedy this. It's best to avoid having unwanted files in a branch altogether obviously, but when run into a situation like in COMMIT 4
, but my question is what should be done?
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 is gone now :( :( :(