【问题标题】:Git pull gives 'Already up-to-date' after committingGit pull 在提交后给出“已经是最新的”
【发布时间】:2015-03-11 13:24:41
【问题描述】:

我正在做一个我使用两个不同虚拟机的东西。在第一个上,我创建了一个文件,我添加、提交并推送到存储库。稍后,我将存储库克隆到另一个 VM 上。然后我回到第一个 VM 对文件进行一些更改以添加并提交更改,然后再拉上第二个 VM。问题是我没有完成所做的更改,它说:Already up-to-date.

在克隆 VM 上,git log 输出:

root@master:/home/test/hello/learning# git log
commit 1f15a20164b57303d1cc8bb8f518b4560ad44ad9
Author: test <test@stud.cn.no>
Date:   Tue Jan 13 14:30:33 2015 +0000

    2nd

commit 77950eb49e28aadd49ddb78b9a48701c4ecb910a
Author: test <test@stud.cn.no>
Date:   Tue Jan 13 14:27:53 2015 +0000

    Forste

在我创建存储库的 VM 上,git log 给出:

root@python:/home/ubuntu/learning# git log
commit 89fead2b83d16373723d06954a0f4f29a695d6f4
Author: test <test@stud.cn.no>
Date:   Tue Jan 13 14:34:31 2015 +0000

    NA

commit 1f15a20164b57303d1cc8bb8f518b4560ad44ad9
Author: test <test@stud.cn.no>
Date:   Tue Jan 13 14:30:33 2015 +0000

    2nd

commit 77950eb49e28aadd49ddb78b9a48701c4ecb910a
Author: test <test@stud.cn.no>
Date:   Tue Jan 13 14:27:53 2015 +0000

    Forste

git status 给出:

# On branch master
# Your branch is ahead of 'origin/master' by 1 commit.
#
nothing to commit (working directory clean)

【问题讨论】:

    标签: git github push gitlab git-pull


    【解决方案1】:

    你忘了push 你的新提交,git status 的输出实际上告诉你:

    # On branch master
    # Your branch is ahead of 'origin/master' by 1 commit.  <--- Right here
    #
    nothing to commit (working directory clean)
    

    记住 Git 是分布式的。您所做的几乎所有事情都只存在于您的本地计算机上,直到您明确共享它,通常通过运行类似 git pushgit push origin master 的东西。

    【讨论】:

    • 我正在执行一项任务,它说我只会提交并拉动以查看我所做的更改。这里:dropbox.com/s/pgobx74mtqrgo9l/pp.png?dl=0
    • @user3270211,这取决于您的遥控器的配置方式。根据您的问题,听起来您有两个 VM 和一个远程(例如 GitHub 或 Bitbucket)。那是 三个 存储库。您在评论中链接到的方向表明您的一个虚拟机应该是另一个虚拟机的远程;您可以将pushfetch / pull 直接连接到VM,而无需通过第三个共享远程。
    • 对,我误解了任务。推和拉应该在这些虚拟机之间(因为您将它们连接到服务器),而不是通过 Github 或 Bitbucket。感谢您为我清理。
    猜你喜欢
    • 2013-11-20
    • 2021-11-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-09-26
    • 2021-03-21
    • 1970-01-01
    相关资源
    最近更新 更多