In this bitbucket tutorial, you will learn about the BitBucket tool. BitBucket tool is used for providing solutions to the Version control system. It makes the entire software team work together through in-class Trello and Jira integrations. The modifications done to the file system are traced easily through the BitBucket tool.
In This BitBucket Tutorial, You Will Learn
- What is BitBucket?
- Version Control System
- BitBucket Terminology
- BitBucket Pipelines
- How to use BitBucket step by step
- Pull Request
- Fork Repository
- BitBucket Markdown
- Advantages of BitBucket
- Git VS BitBucket
BitBucket Tutorial for Beginners - Updated 2021
What is BitBucket
Bitbucket is a version control solution developed by Atlassian. It provides access restrictions to the source code and project workflows. The in-class Jira and Trello integrations of Bitbucket are used to bring the complete software team together to work on the Project.
If you would like to build your career with a Bitbucket certified professional, then visit Mindmajix - A Global online training platform: “Bitbucket Online Training” Course. This course will help you to achieve excellence in this domain.
Version Control System in BitBucket
A Version Control System is also called source control or revision control system. It is a software application that traces and handles modifications to a file system. The VCS also provides some interactive applications that exchange and integrate these modifications to other VCS users. A VCS will trace all the additions, modifications, deletions implemented on a file system.
The branch is a generalization for the operations like a stage, edit, commit process. It is considered as a new approach to request a new working directory.
Generally, a single server-side repository acts as a central repository, but fork provides a server-side repository to every developer. So, every developer will contribute to a server-side repository.
To perform strong operations, we put some code parts into our pipelines, and they are known as Bitbucket Pipes. Pipes are useful in building strong and automated workflows.
4) Bitbucket Pipelines
Bitbucket Pipelines is an incorporated CI/CD Service, made into Bitbucket. It enables you to develop, test automatically, and further deploy the code, according to the configuration file present in the repository.
Subscribe to our youtube channel to get new updates..!
Head is used to refer to the current snapshot. The git checkout upgrades the HEAD to refer to either commit or a particular branch.
Every time you create a repository, a default branch called Master is created, and automatically it becomes a working branch.
7) Pull request
Pull request is a feature provided by Bitbucket, and developers use it for interaction purposes. Developers use this tool to address the proposed changes before incorporating them into the Project.
8) Working Tree
A working tree is defined as a tree of existing checkout files. Generally, it contains HEAD Commit's tree contents and changes you have done but not saved.
A project is considered as a container for repositories. By arranging repositories into projects, the Project makes it easy for the team to emphasize on product, goal, or process.
As we discussed earlier, bitbucket pipelines is an incorporated CI/CD service. It enables us to develop, test, and further deploy the code. Containers are created in the cloud to execute the commands. The clouds are configured based on our requirements.
To establish the pipeline, we need to configure and create the bitbucket-pipelines.YAML file in the root directory of our repository. This file is versioned using configuration-as-code, and it is synchronized with our code.
The Bitbucket-Pipelines. YAML contains the configuration of our repository. YAML is a file repository that is easy to read, but we should be careful while developing it. The important keywords used in the Bitbucket-pipeline.The YAML file is as follows:
i) Default: It includes the steps that need to be executed for every push.
ii) Script: Script contains a list of commands that need to be executed in order.
iii)Pipelines: It includes pipeline definitions.
iv)Step: Each step initiates a new docker container.
Related Article: Git Introduction
How to use BitBucket step by step
1. To start the Version control system Project in Bitbucket, we need to create a project, and then it groups several repositories. Log into BitBucket and click on create Project present in the Project tab.
2. After creating the Project, click on the "+" symbol to create a repository.
3. After creating a new repository, we have to follow the below instructions to clone the Git repository to a local machine.
- In the repository, click the clone button, and then BitBucket shows clone this repository dialog.
- Copy the clone command and then select the directory where you want to clone the repository.
- After that, we should create a branch. For creating a branch, we will click on the branches button, and we will see one branch called "Master" is active. Click on the Create branch present in the right side corner.
- Make some changes in the branch as per your requirement.
4. After cloning the repository to the local machine, we will add the files to the repository.
#1 Pull Request
After the software is delivered, some defects or improvements will be suggested, and the developer's team has to integrate them. When developers have to integrate the improvements, they should take feedback from stakeholders.
So developers will create a bugfix branch to do the required fixes and create a pull request to notify all the reviewers regarding bug fixes and ask them to review to integrate the changes.
Steps for creating a Pull request
- Step1) A defect is reported. Now the developer will create a bugfix branch for making the required changes for fixing the defect and pushes the modifications to the repository.
- Step2) Now the bugfix branch exists in the Bitbucket repository.
- Step3) Before changes are integrated into the master repository, they should be reviewed by the stakeholders. For that purpose, the developer should create a pull request.
- Step4) we will create a pull request by clicking on the create pull request button. In the Pull request, Bugfix is selected as the source branch.
- Step5) Now the reviewers are assigned to the default reviewers list.
- Step6: Now the reviewers log in to their account, and they will review the submitted changes.
- Step7) If the changes are essential, they will approve of them.
- Step8) Now the developer will log in as the user who created the pull request. They will integrate the approved changes into the master repository.
#2 Fork Repository
In Bitbucket, the Fork repository is a method to clone the complete repository for creating a new copy to the repository. It is considered as an experiment to conduct testing without troubling the initial repository.
#3 BitBucket Markdown
Every Project has to keep some documentation to have data regarding releases or requirements or any other information about the Project.
So, the project team should assure that the project documentation should have a standard format. BitBucket uses Markdown to format the documentation file called Readme.md and ".md" is the file extension.
#4 Advantages of BitBucket
- BitBucket Provides Unlimited private repositories.
- Bitbucket gives financial support to private support.
- BitBucket supports continuous integration.
- BitBucket can easily integrate with Jira and Trello.
- We can create an issue tracker in our Git Repository.
Git vs BitBucket
It does not have built-in continuous delivery.
It has built-in continuous delivery.
It cannot trace and preview the deployments.
It can trace and preview the deployments.
It can interact with 5 teammates on unlimited private repositories for free.
It can interact with 5 teammates on unlimited private repositories for free.
It supports Pull Request Approvals
It supports Pull Request Approvals.
It cannot create branches for Jira issues
It can create branches for Jira issues.
The software development teams use bitBucket for CI/CD service. Through Bitbucket, we can clone the git repository for integrating the post-delivery changes. In DevOps practices, we can use BitBucket along with the Git tool.