Code repositories are storage spaces where developers keep all their code and related files, allowing teams to share, collaborate, and manage versions of the code easily. The most popular ones are GitHub and Bitbucket
Basic principles of both Bitbucket and Github are same.
Lets see the principle of how code repositories work.
When we create a new project, a master branch is created. Consider we have only 1 developer. when developer wants to start working on this project he will checkout from main branch and a creak branch would be created. When creak branch created the node will be having the exact replica of the parent node. Whatever changes done by the developer will be saved to the new node as version.
Saving the new code is called "Commit".
Every time developer commits a new version is saved on the new node.
The developer will save the tested code to the main branch and its called "Merge".
Next time when the developer wants to add something to the existing code. He have to checkout from the main branch and a replica of the latest code will be pulled from the latest node.
This is how code is managed if there is only 1 developer.
When multiple developers are involved in the same project, there is a chance of conflict. Lets see how it is handled by code repositories.
Dev1 checkout from main node and started development, at the same time Dev2 also started some development activities .
Dev2 commit the code before Dev1 finish his coding. Now there is a chance of overriding, because Dev1 is unaware of the changes made by Dev2.
To handle this issue, we have something called "Rebase". Rebase simply means checking with the latest node. In our case Dev1 will check with latest Node for any conflicts. And check if any resolution needs to be done before Merge operation is done to the Mater branch.
Now lets see how the actual screen looks like in bitbucket
I have smudged the real filenames, as it can be risky exposing the files. The files marks in red are the repositories.
Create a new repository for our project.
After creating repository, on the left panel you can select what you want to see, source code, commits(versions), branches....
This is how our Main branch and checkout branch looks like in bitbucket.
Comments