Reputation: 524
I am quite new in this area (never used git before), but I've gone through a lot of tutorials and I haven't found the answer to my question. It is quite self-explanatory, but I will add an example.
Let's say we (a team of developers) have a server, example.com
, in full operation. If we want to make changes, we sure have to make them locally, so we all have a copy of the repository on our local machines. But, there is also a copy of the repository on the BitBucket server.
Here comes the problem: when I implement a new feature (add, commit, merge etc.) locally, I want to push it to the global master branch. But which should be the origin? The one on the server or the one on BitBucket? All the tutorials on BitBucket tell me to clone the repository from their server (or upload it there) and perform all the push/pull requests there, but how will then the running server stay up-to-date with those changes? Do I have to pull them manually from BitBucket?
Another option is to clone directly from ssh:example.com/var/www/example/
, but how is then BitBucket going to keep track of branches, commits etc. ?
Help appreciated!
EDIT: In short, I have the code on the server. What steps should I take to be able to work on my local machine, regularly push changes to the running servers and make use of BitBucket?
Upvotes: 1
Views: 220
Reputation: 11483
I would say, for normal development, developers push/pull only from BitBucket. You only push to example.com
for releases. Most workflows feature extensive local development in addition to a "full operation" server that runs production code.
You shouldn't need to always deploy all branches to the server; the server can only host the production version of your code. Hence there is no way to keep multiple branches up to date with the server. Instead, branches are used to track features as they are developed, and eventually merged back in with master
before being pushed to the server.
When you are ready to deploy a new version, you push to the server from any machine. You can use server-side hooks to install new changes on example.com
as they occur.
Upvotes: 3