tags:

views:

49

answers:

1

On the remote production branch, I don't do any changes, so I don't need any branches.

I always want it mirrored to the origin production git checkout origin production works.

But, I can't seem to pull after that.

Is creating a local branch that tracks the origin production by

git checkout -b production --track origin production

the only option, or, I'm wondering, if there is any other way.

+1  A: 

It is the only option of you want to make some commits on a local branch named after a remote-tracking one

You can use the shortcut

git checkout -b --track origin/production

That way, you will be able to pull, since a pull is:

  • a fetch (into FETCH_HEAD, not into remote/origin/production, that is unless remote.origin.fetch is set to a gobbling refspec like +refs/heads/*:refs/remotes/origin/*)
  • plus a merge, and the merge needs potentially to make a commit (which is only possible in a local branch, or on a detach head -- not recommended.)
VonC
So then I guess, I can always remain in the origin/production and do a fetch?
Lakshman Prasad
Yes, if you `git fetch origin`, because if you do git fetch origin production, then only FETCH_HEAD would be updated, and not your remote tracking branch)
VonC