Introduction
Millions of developers, and 80% of Fortune 500 companies, are using Bitbucket Cloud. It is the ideal revision control solution for a professional stack while maintaining repositories, collaborating and delivering software faster in the development cycle. Because of its slick UI, amazing capabilities like branching, integration with third-party add-ons, pipelines, and pull requests, it has been dubbed the Git solution for professional teams.
In this article, I will exclusively focus on the Bitbucket cloud hosting option. You may explore Bitbucket Server and Bitbucket Data Center, the two other hosting solutions, by visiting this page.
What is Bitbucket?
Bitbucket itself is a git-based source code repository hosting service owned by Atlassian. It provides both business subscriptions and free accounts with an unlimited number of private repositories.
What is Bitbucket Cloud?
The Bitbucket cloud is written in Python using the Django Web Framework, and it is mostly used for code and code review. You mainly access its features by visiting a URL. Some of the most common features include pull requests with code review and comments, bitbucket branching, integration, and pipelines. Having understood what bitbucket and bitbucket cloud are, I think we are ready to take the four most important Bitbucket features for a spin.
Before we begin navigating the awesome bitbucket features, please ensure that:
- You understand what Git is and you have it installed on your machine or sandbox. If you're new to Bitbucket, sign up for a Bitbucket Cloud account.
Already a Bitbucket user? Let's set up our environment before exploring these features.
- Go to your Bitbucket Dashboard and create a repository (or import one). Be comfortable playing with the setup here.
Now you will be directed to a new url with your project. Here you can clone the repo in a sandbox or on your local machine. You have three different ways to clone your repository.
- To copy the url and clone the repo from your terminal or command line in your preferred working directory.
- Clone in VS Code. Here you need to have the Jira and Bitbucket extension installed and grant access to Bitbucket.
- Clone in Sourcetree. You need to have the client installed on your machine. (Windows or MAC)
I will import a project for this illustration from github (you can also import from bitbucket if you have an existing repository), which I created initially with StackBlitz ⚡Web Platform, then clone it and make the changes in the VS code editor.
Feature 1: Bitbucket Branching
Using branches, developers may work on a different version of the main codebase without impacting the main version. Consider branching to be a request for a new working location other than the main office. The work done away is then analyzed later to determine whether it may be combined with the primary work to generate a new version of the main work.
In the left sidebar Click Branches to see the current primary work.
Navigate to create
or create branch
to create a new independent working location from Bitbucket. The cool thing about Bitbucket is that you can choose the type of branch you want to work on.
main
ormaster
ordevelop
branch is where the primary development work lies.varies
is a production branch used for deploying a release.feature/
is used to work on adding functionality for the primary work.release/
is for releasing tasks and doing code maintenance.bugfix/
is used when a fixing an issuehotfix/
is used to fix a production branch without impacting the development branch. Let us add a feature to add a button on our home page. You can create a branch following this structure: check out the newly created branch in your local system or sandbox usinggit checkout feature/your_branch_name
Next, add the button and then push changes to the remote add_button branch:$ git add . $ git commit -m "adding a button to home from the add_button branch" $ git push origin feature/add_button
Navigate to your repo and see the changes that you made see that the branch is ahead of the main work:
- Can we add these changes to the main work, so that anybody who wishes to add a button will see that a button already exists?
- Will these changes get approved and merged?
Let's find out: Click on the Actions and click merge when a popup displays. Merge your changes to the main branch and choose to destroy the add_button branch or keep it.
You may already sense the professional zeal when working on the Bitbucket Cloud coding workflow, but wait! there's more🤯...
Feature 2: Bitbucket Pull Requests
Pull requests are a feature that makes it easier for developers to collaborate using Bitbucket. They provide a user-friendly web interface for discussing proposed modifications before incorporating them into the primary work. When a developer makes a pull request, they are simply notifying the project maintainer about the changes they have made. A code review is then conducted before these changes are merged with the main work. Pull requests open a pool for discussions about the proposed changes. Like what might have been done better or any problems with the proposed changes. A pull request is supported by the source repository, the source branch, the destination repository and the destination branch. This is called a Feature branch workflow. Here, Source repository is the same as the destination repository and the main branch is the same as the destination branch. Other workflows include Git workflow, Forking workflow and the Centralized workflow. Pull requests will not work with the centralized workflow as they require two distinct repositories.
- Developers can also file a pull request for incomplete work (work-in-progress) so that they can be helped in implementing a particular feature, release, or hotfix.
- To make it easier for maintainers to track code changes, developers can do an interactive rebase to remove unneccessary commits. Try this interactive tutorial to practice on pull requests
Feature 3: Bitbucket Pipelines
Right next to your code, Bitbucket pipelines allows you to build, test and deploy your code based on how you configure your repositories. With this feature, you get to choose language-specific templates to create your pipeline.
When you choose a template of your choise, a bitbucket-pipelines.yml
YAML file is generated in the YAML editor.
Other options in the YAML editor include Changing the template, adding more steps, adding pipes and adding variables.
You can also specify different images for different dependencies in your YAML and have multiple pipelines as well.
It is also important to note that a pipeline is can include a list of sections with steps that run a separate Docker container such sections include
Feature 4: Bitbucket Integration
Bitbucket Gmail Add-on
Switching between apps is sometimes tiring. Bitbucket cloud can connect with apps such as Gmail to view information and take action on pull requests and pipelines without having to switch betweeen apps with the Atlassian cloud for Gmail Add-on. With this add-on, you an do so much from your inbox. you can
- Act on any Bitbucket, whether it's a colleague's email or an Atlassian product.
- Shows detailed, up-to-date information about the Bitbucket work item, such as its current status, assignee, and the most recent comments.
- Simplifies workflows by allowing you to do actions from your mailbox, such as adding comments, assigning tasks, merging pull requests, and rerunning pipelines.
- Because add-ons are supported in the Gmail app, it works effortlessly across all of your devices.
Bitbucket & Jira
This integration provides an up-to-date board that helps developers track a project in real-time right from within Bitbucket. When you add a repo on Bitbucket, you can easily track project features, bug reports and other issues by using Jira issues tracker.
Bitbucket and Trello Boards Power-Up
Trello includes everything you need to organize and regulate project access (write, admin, or read). You may make a link on your board, attach branches, commits, and pull requests to cards, and show the status of your pull requests, etc. from the front of the card by integrating with Bitbucket Cloud.
Trello boards could be created straight from a Bitbucket Cloud repo or workspace at first as shown below 👇.
However, due to low usage and expensive maintenance costs, the Bitbucket team converted all Trello functionality to interface with Bitbucket Cloud through Power-Up, allowing teams to interact with Bitbucket Cloud features in Trello cards.
Bitbucket will have access to all boards on your account, including those that are on other Workspaces. Additionally, Bitbucket will have access to any boards and Workspaces you gain access to in the future.
You can find other add-ons by navigating to your profile
and find marketplace under your workspace
.
Conclusion
Do you notice how simple and professional it is to add bits to your bitbucket? From simple features like branching to more complex ones like pipeline construction. Developers may quickly browse the interface and control project features even from their mailbox. If you have any queries regarding bitbucket cloud, please leave a comment or ask the community.