Reset

Contains helper functions which allow to deal with git reset.

Functions and values

Function or valueDescription
addArgs commit file
Signature: commit:string -> file:string -> string
hard repositoryDir commit file
Signature: repositoryDir:string -> commit:string -> file:string -> unit

Performs a git reset "hard". Resets the index and working tree. Any changes to tracked files in the working tree since are discarded.

Parameters

  • repositoryDir - The git repository.
  • commit - The commit to which git should perform the reset.
  • file - The file to reset - null means all files.
mixed repositoryDir commit file
Signature: repositoryDir:string -> commit:string -> file:string -> unit

Performs a git reset "mixed". Resets the index but not the working tree and reports what has not been updated.

Parameters

  • repositoryDir - The git repository.
  • commit - The commit to which git should perform the reset.
  • file - The file to reset - null means all files.
ResetHard(repositoryDir)
Signature: repositoryDir:string -> unit

Performs a git reset "hard" to the current HEAD. Resets the index and working tree. Any changes to tracked files in the working tree since are discarded.

Parameters

  • repositoryDir - The git repository.
ResetMixed(repositoryDir)
Signature: repositoryDir:string -> unit

Performs a git reset "mixed" to the current HEAD. Resets the index but not the working tree and reports what has not been updated.

Parameters

  • repositoryDir - The git repository.
resetOrCheckout file mode
Signature: file:string -> mode:string -> string

the intent of the 'reset' helper is to either set a repo to a certain point, or set a file to a certain point. Git reset doesn't take file paths in the hard/mixed/soft modes, and so you have to use checkout instead for that. This function encapsulates caring about that so you don't have to.

ResetSoft(repositoryDir)
Signature: repositoryDir:string -> unit

Performs a git reset "soft" to the current HEAD. Does not touch the index file nor the working tree at all.

Parameters

  • repositoryDir - The git repository.
soft repositoryDir commit file
Signature: repositoryDir:string -> commit:string -> file:string -> unit

Performs a git reset "soft". Does not touch the index file nor the working tree at all.

Parameters

  • repositoryDir - The git repository.
  • commit - The commit to which git should perform the reset.
  • file - The file to reset - null means all files.