我是一个 Git 新手,最近将一个 Rails 项目从 Subversion 迁移到了 Git。我遵循了这里的教程: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进行部署,并从unfuddle存储库使用master分支拉取代码。
最近在我笔记本电脑上运行"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”在哪里?
- 如果它在其他地方,我该如何将我的笔记本电脑变成“origin/master”?
- 让这条消息消失。它让我觉得Git对某些事情感到不满意。
我的Mac正在运行Git版本1.6.0.1。
当我像dbr建议的那样运行git remote show origin
时,我得到以下结果:
~/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
按照 Aristotle Pagaltzis 的建议,当我运行 git remote -v
时,我会得到以下输出:
~/Projects/GeekFor/geekfor 10:33 AM $ git remote -v
origin /Users/brian/Projects/GeekFor/gf/.git
unfuddle git@spilth.unfuddle.com:spilth/geekfor.git
有趣的是,我正在geekfor
目录中开发我的项目,但它显示我的源是在gf
目录的本地机器上。我相信在将我的项目从 Subversion 转换为 Git 时,gf
是我使用的临时目录,也可能是我从中向 unfuddle 推送的目录。然后我相信我从 unfuddle 检出了一个新副本到geekfor
目录。
所以看起来我应该遵循dbr的建议,执行:
git remote rm origin
git remote add origin git@spilth.unfuddle.com:spilth/geekfor.git