checkout

package
v1.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 8, 2020 License: Apache-2.0 Imports: 2 Imported by: 7

Documentation

Overview

Package checkout git-checkout - Switch branches or restore working tree files.

SYNOPSIS

Reference: https://git-scm.com/docs/git-checkout

git checkout [-q] [-f] [-m] [<branch>]
git checkout [-q] [-f] [-m] --detach [<branch>]
git checkout [-q] [-f] [-m] [--detach] <commit>
git checkout [-q] [-f] [-m] [[-b|-B|--orphan] <new_branch>] [<start_point>]
git checkout [-f|--ours|--theirs|-m|--conflict=<style>] [<tree-ish>] [--] <paths>...
git checkout [-p|--patch] [<tree-ish>] [--] [<paths>...]

DESCRIPTION

Updates files in the working tree to match the version in the index or the specified tree. If no paths are given, git checkout will also update HEAD to set the specified branch as the current branch.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Branch

func Branch(name string) func(*types.Cmd)

Branch to checkout; if it refers to a branch (i.e., a name that, when prepended with 'refs/heads/', is a valid ref), then that branch is checked out. Otherwise, if it refers to a valid commit, your HEAD becomes 'detached' and you are no longer on any branch (see below for details). <branch> or <new_branch> Name for the new branch.

func Conflict added in v0.6.0

func Conflict(style string) func(*types.Cmd)

Conflict The same as --merge option above, but changes the way the conflicting hunks are presented, overriding the merge.conflictStyle configuration variable. Possible values are 'merge' (default) and 'diff3' (in addition to what is shown by 'merge' style, shows the original contents). --conflict=<style>

func Detach

func Detach(g *types.Cmd)

Detach Rather than checking out a branch to work on it, check out a commit for inspection and discardable experiments. This is the default behavior of 'git checkout <commit>' when <commit> is not a branch name. See the 'DETACHED HEAD' section below for details. --detach

func Force

func Force(g *types.Cmd)

Force When switching branches, proceed even if the index or the working tree differs from HEAD. This is used to throw away local changes. When checking out paths from the index, do not fail upon unmerged entries; instead, unmerged entries are ignored. -f, --force

func IgnoreOtherWorktrees

func IgnoreOtherWorktrees(g *types.Cmd)

IgnoreOtherWorktrees git checkout refuses when the wanted ref is already checked out by another worktree. This option makes it check the ref out anyway. In other words, the ref can be held by more than one worktree. --ignore-other-worktrees

func IgnoreSkipWorktreeBits

func IgnoreSkipWorktreeBits(g *types.Cmd)

IgnoreSkipWorktreeBits In sparse checkout mode, git checkout -- <paths> would update only entries matched by <paths> and sparse patterns in $GIT_DIR/info/sparse-checkout. This option ignores the sparse patterns and adds back any files in <paths>. --ignore-skip-worktree-bits

func Merge

func Merge(g *types.Cmd)

Merge When switching branches, if you have local modifications to one or more files that are different between the current branch and the branch to which you are switching, the command refuses to switch branches in order to preserve your modifications in context. However, with this option, a three-way merge between the current branch, your working tree contents, and the new branch is done, and you will be on the new branch. -m, --merge

func NewBranch

func NewBranch(value string) func(*types.Cmd)

NewBranch Create a new branch named <new_branch> and start it at <start_point>; see git-branch(1) for details. -b [new_branch]

func NewBranchForce

func NewBranchForce(newBranch string) func(*types.Cmd)

NewBranchForce Creates the branch <new_branch> and start it at <start_point>; if it already exists, then reset it to <start_point>. This is equivalent to running 'git branch' with '-f'; see git-branch(1) for details. -B [new_branch]

func NewBranchReflog added in v0.13.0

func NewBranchReflog(g *types.Cmd)

NewBranchReflog Create the new branch’s reflog; see git-branch(1) for details. -l

func NoProgress

func NoProgress(g *types.Cmd)

NoProgress Progress status is reported on the standard error stream by default when it is attached to a terminal, unless --quiet is specified. This flag enables progress reporting even if not attached to a terminal, regardless of --quiet. --no-progress

func NoRecurseSubmodules

func NoRecurseSubmodules(g *types.Cmd)

NoRecurseSubmodules Using --recurse-submodules will update the content of all initialized submodules according to the commit recorded in the superproject. If local modifications in a submodule would be overwritten the checkout will fail unless -f is used. If nothing (or --no-recurse-submodules) is used, the work trees of submodules will not be updated. --no-recurse-submodules

func NoTrack

func NoTrack(g *types.Cmd)

NoTrack Do not set up 'upstream' configuration, even if the branch.autoSetupMerge configuration variable is true. --no-track

func Orphan

func Orphan(newBranch string) func(*types.Cmd)

Orphan Create a new orphan branch, named <new_branch>, started from <start_point> and switch to it. The first commit made on this new branch will have no parents and it will be the root of a new history totally disconnected from all the other branches and commits. --orphan <new_branch>

func Ours

func Ours(g *types.Cmd)

Ours When checking out paths from the index, check out stage #2 (ours) or #3 (theirs) for unmerged paths. --ours, --theirs

func Patch

func Patch(g *types.Cmd)

Patch Interactively select hunks in the difference between the <tree-ish> (or the index, if unspecified) and the working tree. The chosen hunks are then applied in reverse to the working tree (and if a <tree-ish> was specified, the index). -p, --patch

func Path added in v0.13.0

func Path(values ...string) func(*types.Cmd)

Path <paths>...

func Progress

func Progress(g *types.Cmd)

Progress Progress status is reported on the standard error stream by default when it is attached to a terminal, unless --quiet is specified. This flag enables progress reporting even if not attached to a terminal, regardless of --quiet. --progress

func Quiet

func Quiet(g *types.Cmd)

Quiet Quiet, suppress feedback messages. -q, --quiet

func RecurseSubmodules

func RecurseSubmodules(g *types.Cmd)

RecurseSubmodules Using --recurse-submodules will update the content of all initialized submodules according to the commit recorded in the superproject. If local modifications in a submodule would be overwritten the checkout will fail unless -f is used. If nothing (or --no-recurse-submodules) is used, the work trees of submodules will not be updated. --recurse-submodules

func StartPoint added in v0.5.0

func StartPoint(name string) func(*types.Cmd)

StartPoint The name of a commit at which to start the new branch; see git-branch(1) for details. Defaults to HEAD. <start_point>

func Theirs

func Theirs(g *types.Cmd)

Theirs When checking out paths from the index, check out stage #2 (ours) or #3 (theirs) for unmerged paths. --ours, --theirs

func Track

func Track(g *types.Cmd)

Track When creating a new branch, set up 'upstream' configuration. See '--track' in git-branch(1) for details. -t, --track

func TreeIsh added in v0.13.0

func TreeIsh(value string) func(*types.Cmd)

TreeIsh Tree to checkout from (when paths are given). If not specified, the index will be used. <tree-ish>

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL