【问题标题】:git nothing to commit working directory cleangit nothing 提交工作目录 clean
【发布时间】:2015-06-17 04:23:12
【问题描述】:

我的 git remote origin 是我的工作目录,我的 git remote 'upstream' 是我开发的项目。当我使用

git pull upstream master

我可以看到我已经在上游目录中获得了最新的更改,并且我使用了

git add --all

git 给出了一些插入,一些删除,这些都可以。

但是当我使用时:

git commit -m "..."

我总是收到这个错误

nothing to commit working directory clean

git push origin master

git 说

already up to date

我检查了我的原始目录,发现它不包含上游目录中的最新更新

我见过same question。他说他遇到这个问题是因为他输入了错误的目录,但我确定我在正确的目录中。

我问过一个人,他用过

git log

找出我最新的提交序列号并使用了一些命令,如
git merge (commit serial number) 解决了我的问题,但我忘记了他使用的确切命令。

他解释说 HEAD 指针指向另一个与我最新提交不同的位置,但当时我不太明白。
我对git不熟悉,有人可以解释为什么会发生这种情况以及如何解决这个问题吗? (就像我说的,我忘记了他使用的确切命令,我现在遇到了同样的问题,我不知道如何解决它)

【问题讨论】:

    标签: git github version-control branch


    【解决方案1】:

    从远程分支获取后,您仍然需要合并提交。

    git fetch upstream
    git merge upstream/master master
    git rebase upstream/master
    

    【讨论】:

      猜你喜欢
      • 2022-01-12
      • 2016-09-13
      • 2014-01-24
      • 2011-11-03
      • 2013-02-02
      • 2015-08-30
      • 1970-01-01
      • 1970-01-01
      • 2013-06-05
      相关资源
      最近更新 更多