git checkout

NAME
       git-checkout - Checkout a branch or paths to the working tree


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




DESCRIPTION
       When <paths> are not given, this command switches branches by updating
       the index, working tree, and HEAD to reflect the specified branch.


       If -b is given, a new branch is created and checked out, as if git-
       branch(1) were called; in this case you can use the --track or
       --no-track options, which will be passed to git branch. As a
       convenience, --track without -b implies branch creation; see the
       description of --track below.


       When <paths> or --patch are given, this command does not switch
       branches. It updates the named paths in the working tree from the index
       file,
or from a named <tree-ish> (most often a commit). In this case,
       the -b and --track options are meaningless and giving either of them
       results in an error. The <tree-ish> argument can be used to specify a
       specific tree-ish (i.e. commit, tag or tree) to update the index for

       the given paths before updating the working tree.


git checkout  -- file 会从index(暂存区域)里更新,而不是从提交中更新


       The index may contain unmerged entries after a failed merge. By
       default, if you try to check out such an entry from the index, the
       checkout operation will fail and nothing will be checked out. Using -f
       will ignore these unmerged entries. The contents from a specific side
       of the merge can be checked out of the index by using --ours or
       --theirs. With -m, changes made to the working tree file can be
       discarded to recreate the original conflicted merge result.
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值