abortMerge
Abort a merge in progress.
param | type [= default] | description |
---|---|---|
fs | FsClient | a file system implementation |
dir | string | The working tree directory path |
gitdir | string = join(dir, '.git') | The git directory path |
commit | string = 'HEAD' | commit to reset the index and worktree to, defaults to HEAD |
cache | object | a cache object |
return | Promise<void> | Resolves successfully once the git index has been updated |
Based on the behavior of git reset --merge, i.e. "Resets the index and updates the files in the working tree that are different between
Essentially, abortMerge will reset any files affected by merge conflicts to their last known good version at HEAD. Any unstaged changes are saved and any staged changes are reset as well.
NOTE: The behavior of this command differs slightly from canonical git in that an error will be thrown if a file exists in the index and nowhere else. Canonical git will reset the file and continue aborting the merge in this case.
WARNING: Running git merge with non-trivial uncommitted changes is discouraged: while possible, it may leave you in a state that is hard to back out of in the case of a conflict.
If there were uncommitted changes when the merge started (and especially if those changes were further modified after the merge was started), git.abortMerge
will in some cases be unable to reconstruct the original (pre-merge) changes.
Tip: If you need a clean slate, expand and run this snippet to clean up the file system.
window.fs = new LightningFS('fs', { wipe: true })
window.pfs = window.fs.promises
console.log('done')