跳至主要內容
  • Hostloc 空間訪問刷分
  • 售賣場
  • 廣告位
  • 賣站?

4563博客

全新的繁體中文 WordPress 網站
  • 首頁
  • 在新分支 commit 之后,切换到 master 分支,为什么会提示 Your branch is ahead of ‘origin/master’ by 1 commit.
未分類
20 2 月 2021

在新分支 commit 之后,切换到 master 分支,为什么会提示 Your branch is ahead of ‘origin/master’ by 1 commit.

在新分支 commit 之后,切换到 master 分支,为什么会提示 Your branch is ahead of ‘origin/master’ by 1 commit.

資深大佬 : zxCoder 6

先 checkout 到 feature 分支,然后提交内容,然后切换到 master 分支,为什么是提示

Your branch is ahead of 'origin/master' by 1 commit. 

这个意思是本地的 master 分支领先远程 master 一个提交吗??可是我不是在 feature 分支提交的吗?要领先不也是 feature 分支领先吗?

大佬有話說 (6)

  • 資深大佬 : geelaw

    看一下 git 的历史图不就知道了么

  • 資深大佬 : zyfsuzy

    感觉不大可能,一定是你提交错了

  • 主 資深大佬 : zxCoder

    @geelaw
    @zyfsuzy

    “`
    $ git switch -c a
    Switched to a new branch ‘a’
    $ git branch
    * a
    dev
    feature1
    master
    $ touch a.txt
    $ git add a.txt
    $ git commit -m “add a.txt”
    [a fdaf3d8] add a.txt
    1 file changed, 0 insertions(+), 0 deletions(-)
    create mode 100644 a.txt
    $ git switch master
    Switched to branch ‘master’
    Your branch is ahead of ‘origin/master’ by 1 commit.
    (use “git push” to publish your local commits)
    “`

    请问这样操作哪里出问题了呢

  • 資深大佬 : icylogic

    git log origin/master..HEAD
    看一下不就知道了……

  • 資深大佬 : geelaw

    #3 可能是在对 a 操作之前 master 已经领先 origin/master 了

  • 資深大佬 : zyfsuzy

    你确定你切换到 master 分支了? 分支切换不是 git checkout 命令么? git log 看看

文章導覽

上一篇文章
下一篇文章

AD

其他操作

  • 登入
  • 訂閱網站內容的資訊提供
  • 訂閱留言的資訊提供
  • WordPress.org 台灣繁體中文

51la

4563博客

全新的繁體中文 WordPress 網站
返回頂端
本站採用 WordPress 建置 | 佈景主題採用 GretaThemes 所設計的 Memory
4563博客
  • Hostloc 空間訪問刷分
  • 售賣場
  • 廣告位
  • 賣站?
在這裡新增小工具