Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/git/24.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在同一个命令中应用和删除最新的git存储?_Git - Fatal编程技术网

如何在同一个命令中应用和删除最新的git存储?

如何在同一个命令中应用和删除最新的git存储?,git,Git,似乎在执行git stash apply时,需要输入git stash drop,以便从可用的stash中删除该stash。我可以在一个命令中完成此操作吗?git stash pop是您需要的。正如政府所说: pop[--index][q |--quiet][] 从隐藏列表中删除单个隐藏状态并将其应用于 当前工作树状态的顶部,即执行反向操作 吉特的藏匿保存。工作目录必须与索引匹配。 应用状态可能会因冲突而失败;在这种情况下,情况并非如此 从隐藏列表中删除。您需要手动解决冲突 然后手动调用git

似乎在执行git stash apply时,需要输入git stash drop,以便从可用的stash中删除该stash。我可以在一个命令中完成此操作吗?

git stash pop
是您需要的。正如政府所说:

pop[--index][q |--quiet][]
从隐藏列表中删除单个隐藏状态并将其应用于
当前工作树状态的顶部,即执行反向操作
吉特的藏匿保存。工作目录必须与索引匹配。
应用状态可能会因冲突而失败;在这种情况下,情况并非如此
从隐藏列表中删除。您需要手动解决冲突
然后手动调用git stash drop。

请注意,如果出现合并冲突,在解决冲突后,您仍然必须手动
删除
隐藏。
pop [--index] [-q|--quiet] [<stash>]

    Remove a single stashed state from the stash list and apply it on
    top of the current working tree state, i.e., do the inverse operation
    of git stash save. The working directory must match the index.

    Applying the state can fail with conflicts; in this case, it is not
    removed from the stash list. You need to resolve the conflicts by hand
    and call git stash drop manually afterwards.