【问题标题】:`git stash create` does not return a hash`git stash create` 不返回哈希
【发布时间】:2020-07-17 23:23:16
【问题描述】:

示例(bash):

> cd ~/repo1
> git stash create

显然有问题,也许已经隐藏了一些东西

> git stash drop
No stash entries found

可能是 git 出了点问题,随便挑一个其他的repository然后重新运行

> cd ~/repo2
> git stash create
f6fed634ce4de28d8696de39f6a338df8edef59c

这是怎么回事?

【问题讨论】:

  • 这并不是真正的 MWE,因为我的系统上不存在 ~/repo1。你做了什么导致这一切?也许您在 repo 的 gitconfig 中为 stash 添加了别名?试试git help stash。顺便说一句,您使用的是什么外壳?
  • 非常正确,@wjandrea,OP 已更正
  • 那是 Bash 吗? cd(...) 是无效的语法。也许您使用的是其他版本或开启了某些功能?
  • 谢谢,这是一个错字,在我更新帖子以添加 cd 之前一直在写一些 Julia,以使示例更具凝聚力。

标签: git git-bash git-stash git-hash


【解决方案1】:

如果没有要存储的内容,没有未暂存或暂存的更改,则不会生成提交对象。

$ git status
On branch master
Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git restore <file>..." to discard changes in working directory)
    modified:   this
$ git stash create
a42c068d4b8139a6d572ad04e77f1bd0057b3408

$ git restore this
$ git status
On branch master
nothing to commit, working tree clean
$ git stash create
$

【讨论】:

    猜你喜欢
    • 2011-09-29
    • 2013-10-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-07-14
    • 1970-01-01
    • 2017-06-22
    • 2020-06-01
    相关资源
    最近更新 更多