开发者

How to handle git with two repositories

This is probably a novice question, so I apologize for my daftness ahead of time.

I am deploying to Heroku, and managing my repository through github. So I have two git accounts with one code base. My .git/config looks like this :

[core]
        repositoryformatversion = 0
        filemode = true
        bare = false
        logallrefupdates = true
        ignorecase = true
[remote "origin"]
        url = git@github.com:gotoAndBliss/True-Jersey.git
        fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
        remote = origin
        merge = refs/heads/master
[remote "heroku"]
        url = git@heroku开发者_如何学C.com:jersey.git
        fetch = +refs/heads/*:refs/remotes/heroku/*

The trouble is when I perform git status , it claims the working directory is clean and that there is nothing to commit because it's only referring to my origin. How do I get it to know its dirty for heroku so i can push the latest changes to my heroku repository?

Thanks!


"Nothing to commit" doesn't have anything to do with remotes like origin. It simply means that there is no difference between your work tree and the current commit in your local repository.

You may, however, see hints like "Your branch is ahead of 'origin/master' by 1 commit". This is the reminder you're really wanting, and it's true that it only refers to one remote, the one your current branch is tracking a remote branch from (generally origin). However, it's just a reminder. It's up to you to run something like:

git push <remote>            # push all matching branches
git push <remote> <branch>   # push one branch

to push the desired branch(es) to the desired remote, whether it be origin (referring to github) or heroku.


check out

http://suitmymind.com/blog/2009/06/02/deploying-multiple-environments-on-heroku-while-still-hosting-code-on-github

It should help.

I think normally you would just do something like

git push heroku master

and it would push your master to heroku

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜