setHead
Make the repository HEAD point to the specified reference.
If the provided reference points to a tree or a blob, the HEAD is unaltered and an error is returned.
If the provided reference points to a branch, the HEAD will point to that branch, staying attached, or become attached if it isn't yet. If the branch doesn't exist yet, no error will be returned. The HEAD will then be attached to an unborn branch.
Otherwise, the HEAD will be detached and will directly point to the commit.
Signature
ts
class Repository {
setHead(refname: string): void;
}Parameters
- refnamerequired · string
Specified reference to point into
HEAD.
