我是 Git 新手。我最近将一个 Rails 项目从 Subversion 迁移到了 Git。我按照这里的教程进行操作:http://www.simplisticcomplexity.com/2008/03/05/cleanly-migrate-your-subversion-repository-to-a-git-repository/ http://www.simplisticcomplexity.com/2008/03/05/cleanly-migrate-your-subversion-repository-to-a-git-repository/
我还使用 unfuddle.com 来存储我的代码。我在上下班的火车上对我的 Mac 笔记本电脑进行了更改,然后在有网络连接时使用以下命令将它们推送到 unfuddle:
git push unfuddle master
我使用 Capistrano 进行部署,并使用 master 分支从 unfuddle 存储库中提取代码。
最近,当我在笔记本电脑上运行“git status”时,我注意到以下消息:
# On branch master
# Your branch is ahead of 'origin/master' by 11 commits.
#
nothing to commit (working directory clean)
我很困惑为什么。我以为我的笔记本电脑是起源...但不知道我最初从 Subversion 拉取或推送到 Unfuddle 的事实是否是导致该消息显示的原因。我怎么能够:
- 找出 Git 认为“origin/master”在哪里?
- 如果它在其他地方,我如何将我的笔记本电脑变成“原始/主”?
- 得到这个消息就走开。这让我觉得 Git 对某些事情不满意。
我的 Mac 运行的是 Git 版本 1.6.0.1。
当我跑步时git remote show origin
根据 dbr 的建议,我得到以下信息:
~/Projects/GeekFor/geekfor 10:47 AM $ git remote show origin
fatal: '/Users/brian/Projects/GeekFor/gf/.git': unable to chdir or not a git archive
fatal: The remote end hung up unexpectedly
当我跑步时git remote -v
根据亚里士多德·帕加尔齐斯(Aristotle Pagaltzis)的建议,我得到以下结论:
~/Projects/GeekFor/geekfor 10:33 AM $ git remote -v
origin /Users/brian/Projects/GeekFor/gf/.git
unfuddle [email protected] /cdn-cgi/l/email-protection:spilth/geekfor.git
现在,有趣的是,我正在做我的项目geekfor
目录,但它说我的来源是我的本地计算机gf
目录。我相信gf
是我在将项目从 Subversion 转换为 Git 时使用的临时目录,也可能是我从中摆脱混乱的地方。然后我相信我从 unfuddle 中查看了一份新副本geekfor
目录。
所以看来我应该听从 dbr 的建议并执行以下操作:
git remote rm origin
git remote add origin [email protected] /cdn-cgi/l/email-protection:spilth/geekfor.git