In Pro Git you can see:

Remote-tracking branches are references to the state of remote branches. They’re local references that you can’t move; they’re moved automatically for you whenever you do any network communication ...

So remote tracking branches are described as read only but it is possible to update, edit and delete a remote tracking branch by a local branch of current repository. For example:

$ git push . :refs/remotes/origin/master

Which deletes remote tracking branch. But is updating a remote tracking branch by local branch a good practice? If yes, is there another usage of that work?

  • Do you mean pushing changes from a local branch to a remote branch? May 16, 2016 at 17:01
  • @MikePartridge Yes. Is that a good practice or has any logical usage? May 16, 2016 at 17:03
  • Pushing a local branch to a remote (e.g. origin) is a common practice when the remote is being used as a central repository. May 16, 2016 at 18:02
  • @MikePartridge Pushing to a repository in central workflow will updates related remote branches after updating refs in remote repository. But I mean updating a remote branch directly without syncing with remote repository. May 16, 2016 at 18:22
  • I suspect that using . as the remote invokes the git equivalent of undefined behavior. May 17, 2016 at 1:15


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.