Git – push to a remote-tracking branch in the remote repository
When simply doing
git push to a remote repository, its
master branch gets updated. This is undesirable in the case of non-bare repositories, and the warning message displayed by recent Git versions makes that clear.
I’d like to be able to push to a remote repository, and have one of its remote tracking branches be updated. Later, when I log in to the remote machine and run commands, I can choose to merge that remote tracking branch into
- How to push a commit with a tag to a remote branch in git?
- PhpStorm can not push to git repository
- push changes to a branch without merging?
- How to disable git push when there are TODOs in code?
- I can't git push recently, what happened to my Git?
- Git “Fetch URL” and “Push URL”, whats the difference?
How can I do that? Or is there a better way to push changes to a non-bare repository?
2 Solutions collect form web for “Git – push to a remote-tracking branch in the remote repository”
You can do:
git push master:some-remote-branch
git push master:alex/master
(Although it is still not recommended to push to non-bare repository.)
I guess you should just set up a separate bare repository, ie. one without a working copy. Then you could just log in to the remote machine and clone this remote repository, and fetch/pull whenever you need it.