1

所以我有一个分支develop,并从中创建了一个新分支git checkout -b syntax_highlight

问题是,当我去我的新分支时,新分支中Gemfile的我与父分支不同。

就像我Gemfile在后台打开的一样,当我切换分支时我可以看到它发生了变化。

然而,没有任何上演。

$ git checkout syntax_highlight
Already on 'syntax_highlight'
$ git rebase develop
Current branch syntax_highlight is up to date.
$ git checkout develop
Switched to branch 'develop'
$ git checkout syntax_highlight
Switched to branch 'syntax_highlight'
$ git checkout develop
Switched to branch 'develop'
$ git status
# On branch develop
nothing to commit (working directory clean)
$ git checkout syntax_highlight
Switched to branch 'syntax_highlight'
$ git status
# On branch syntax_highlight
nothing to commit (working directory clean)

对于我的生活,我无法弄清楚为什么我的存在差异,Gemfile这让我想知道是否还有 git 没有告诉我的其他差异。

编辑 1

在两个分支上运行后git log,您将看到两者都有相同的提交,只是该syntax_highlight分支有 1 个最近的提交 - 这是有道理的,因为那是我当前正在处理的分支。

$ git log
commit a0b320a001cb24f42e2cf0f3dfee38cfd53e2290
Author: marcamillion
Date:   Thu Mar 28 02:27:08 2013 -0500

    Got the HABTM counter_cache working.

commit 64b73338c34259f02daa2ed943bd5d47ac5bacc0
Author: marcamillion
Date:   Mon Mar 25 03:16:43 2013 -0500

    Added the basic sidebar layout.

commit 7989813e9a379e480500f12ee01367967b791cd4
Author: marcamillion
Date:   Sun Mar 24 14:36:33 2013 -0500

    Got the basics of the sidebar layout, along with the navigational bar listing useful tags.

commit 1f0feea2f6db36e5c89aaf83c51cfc3b4bdbf01f
Author: marcamillion
Date:   Sun Mar 24 02:48:20 2013 -0500

    Installed bullet gem.


##

$ git checkout syntax_highlight
Switched to branch 'syntax_highlight'
$ git log
commit cccc5cd3350dbcd751e1ceccd0d4865948fd6993
Author: marcamillion
Date:   Thu Mar 28 03:02:20 2013 -0500

    Installed pygments, but haven't been able to test successfully yet.

commit a0b320a001cb24f42e2cf0f3dfee38cfd53e2290
Author: marcamillion
Date:   Thu Mar 28 02:27:08 2013 -0500

    Got the HABTM counter_cache working.

commit 64b73338c34259f02daa2ed943bd5d47ac5bacc0
Author: marcamillion
Date:   Mon Mar 25 03:16:43 2013 -0500

    Added the basic sidebar layout.

commit 7989813e9a379e480500f12ee01367967b791cd4
Author: marcamillion
Date:   Sun Mar 24 14:36:33 2013 -0500

    Got the basics of the sidebar layout, along with the navigational bar listing useful tags.

commit 1f0feea2f6db36e5c89aaf83c51cfc3b4bdbf01f
Author: marcamillion
Date:   Sun Mar 24 02:48:20 2013 -0500

    Installed bullet gem.

编辑 2

这是git diff一个特定的结果:

$ git diff-tree --no-commit-id --name-only -r cccc5cd3350dbcd751e1ceccd0d4865948fd6993
Gemfile
Gemfile.lock
app/assets/stylesheets/pygments.css.erb
app/views/home/index.html.erb
4

2 回答 2

1

我不知道你为什么期望它是一样的(除非你确定你从未提交过文件)。你可以在两个分支上运行 git log 吗?

于 2013-03-28T08:21:39.607 回答
0

您来自 cccc5cd3350dbcd751e1ceccd0d4865948fd6993 的提交已经更新了 Gemfile...所以期待看到您的 Gemfile 更新...当您从开发中重新设置基准时,您只需在开发的任何更改之上重新应用您的提交(无)。您的 syntax_highlight 分支的唯一更改是上面提到的更新 Gemfile 的提交。这有意义吗?

于 2013-03-28T10:11:12.567 回答