We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent dee9185 commit 01d2c0dCopy full SHA for 01d2c0d
src/git/actions/commit.ts
@@ -71,8 +71,8 @@ export async function applyChanges(
71
} catch {
72
create = true;
73
74
- ref2 = ref1;
75
- ref1 = `${ref1}^`;
+ // If restoring a deleted file (e.g. a newly added file), swap the refs to restore from the previous commit
+ [ref1, ref2] = [ref2 === '' ? 'HEAD' : ref2 ?? `${ref1}^`, ref1];
76
}
77
78
0 commit comments