【问题标题】:Can't push CSS changes to origin/master.. Everything up-to-date无法将 CSS 更改推送到 origin/master .. 一切都是最新的
【发布时间】:2014-05-23 10:59:58
【问题描述】:

我很困惑。我做了一个分支来对我的 Ruby on Rails 应用程序进行 css 更改。让我们调用分支Update_CSS在我进行更改后,我做了git status,它表明没有添加css文件,所以我用git add app/assets/stylesheets/application.css添加了它们,然后我用git commit -am "Updated CSS"提交了我的更改。然后我检查了 master 并合并了带有 CSS 更改的分支:

git checkout Master
git merge Update_CSS

终端说更改已合并,等等。然后尝试推送到 git:git push。然后我收到了以下消息Everything up-to-date!什么?!果然,我在 Github 上查看,CSS 文件与我机器上的不同。实际上,我有几个 CSS 文件在我的机器上而不是在 origin/master 上合并和提交。知道发生了什么或如何解决这个问题。理想情况下,我想用本地 master 上的文件覆盖 origin/master 中的文件。

更新:当我用小“​​m”运行git checkout master 时,输出显示为:Your branch is ahead of 'origin/master' by 9 commits. 我想知道我是否对“master”的大写粗心,并且不知何故搞砸了向上。我尝试更改 Master 上的其他文件,提交更改并推送到 git,现在我总是得到 Everything up-to-date

【问题讨论】:

  • 作为一个临时解决方案,当我遇到类似的问题时,我对代码进行了毫无意义的更改,比如在控制器中添加一个空行,然后提交并推送。此外,如果推送到 Heroku,您需要先“rake assets:clobber”和“rake assets:precompile RAILS_ENV=production --trace”,然后再推送。
  • “git log --graph”告诉你什么?
  • 这可能不是非常准确,因为我尝试了其他一些方法,但 git log --graph 的输出是:16:44:16-sergio~/Desktop/Code/atma (Master)$ git log --graph * commit bb18dd6df6507b2bbd511baf68e1373a25d262f3 | Author: Sergio Paluch <sergiopaluch@gmail.com> | Date: Wed Apr 9 16:33:04 2014 -0700 | | Got rid of junk in application.css | * commit 2b85367175198f4934ee48b0028cfb18be45110e |\ Merge: e3e129f 422facc | | Author: Sergio Paluch <sergiopaluch@gmail.com> | | Date: Wed Apr 9 16:29:51 2014 -0700 | | | | Merge branch 'Make_Span_Viewport' into Master
  • 继续..| * commit 422facce779e36828db9b073f563816dab4f4788 | | Author: Sergio Paluch <sergiopaluch@gmail.com> | | Date: Wed Apr 9 16:29:04 2014 -0700 | | | | Got rid of junk in application.css | | * | commit e3e129f9be38325d8e864c2ef553f034107293c7 |/ Author: Sergio Paluch <sergiopaluch@gmail.com> | Date: Wed Apr 9 16:22:16 2014 -0700 |
  • 感谢您的建议,克里斯!我实际上尝试进行无意义的编辑以再次提交。基本上,遵循与以前相同的工作流程。所有提交在我的机器上都顺利完成,但是当我尝试推送到 origin/master 时,我不断得到“一切都是最新的”。我不知道 Heroku 的 rake assets:precompile,所以谢谢!

标签: git github push git-commit


【解决方案1】:

我不太确定它是怎么发生的,但是当我签出 master 以合并我的分支时,我输入了带有大写 m 的“Master”。我没有与大师合并,而是与大师合并。我的解决方案是根据this thread 使用git reset --hard origin/master 将更新设置为master 并重置我的本地分支

我很想详细了解这里实际发生的情况,因为我不确定我是否完全明白。谢谢!

【讨论】:

  • 分支名称区分大小写是你的罪魁祸首
猜你喜欢
  • 2012-06-20
  • 1970-01-01
  • 2010-11-26
  • 2015-11-14
  • 2015-02-04
  • 2019-08-01
  • 1970-01-01
  • 1970-01-01
  • 2012-01-31
相关资源
最近更新 更多