WORKING WITH BITBUCKET

Bitbucket is a hosting site for the distributed version control systems (DVCS) Git and Mercurial more

Bitbucket offers two types of repositories.

  1. Public – available to all the users around the globe.
  2. Private – only invited users have access (read, write, admin

You must have at least read only access to work with bitbucket repository. There are several steps to follow when working with bitbucket in development process.

Downloading code from bitbucket for development

Before starting any changes, we need to have the source files. Bitbucket documentation suggests that you follow the steps given below.

  1. Create a Fork of the repository. (Forking a repository creates a new repository under your online bitbucket account. This new repository is a copy of the original repo and is called a fork.)ForkFork Repository
  2. Clone the forked repo from Bitbucket to your local system. On your local system execute the following command to clone the bitbucket repository.$ git clone https://username@bitbucket.org/user/repo-name.git
  3. There is a possibility that git gives you an error; (error: SSL certificate problem, verify that the CA cert is OK.)

    If this is the case, then you have three solutions to resolve this error.

    • Execute each git command with this format.

             $ env GIT_SSL_NO_VERIFY=true git clone ………

    • Execute the following command in your repository folder to temporarily disable SSL

             $ git config http.sslVerify false

    • Execute the following command to disable SSL on all local commands

                             $ git config –global http.sslVerify false

Uploading changes at bitbucket

After downloading the code, you can make any changes which you need to resolve the issues. And once you are finished with changes you can push your changes at bitbucket. The steps to push changes at bitbucket are given below.

  1. Start git bash and move in the local directory (using cd command) where your bitbucket repository is residing.
  2. Execute the following git commands.
    1. $ git add .
    2. $ git commit –m “your comments about this change”
    3. $ git push –u origin local-branch-name (to push one local branch at bitbucket) OR
    4. $ git push –u origin –all (to push all local branches at bitbucket)

Merging changes on bitbucket

Since you created a fork to work with, so after pushing changes at bitbucket you need to merge the changes with your original repository. Below are the steps to merge changes at bitbucket.

  1. Go to the fork repository.
  2. Click on Pull Request link.
    Merge
  3. It will display Create Pull Request page. Select source branch, destination branch and provide title and description of the Pull Request.
    Pull Request
  4. If there are any conflicts, the screen will also show the conflicts and the commands to resolve the conflicts. And Pull Request with conflict cannot be merged automatically.
  5. When you create a Pull Request, the administrator of original repository will see list of Pull Requests in his repository.
    Pull request repository
  6. The administrator can view details of any Pull Request by clicking on its title.
    Merge
  7. Administrator can Merge, Edit, Decline or Approve any Pull Request.
  8. After merge process, the changes of the source branch of Pull Request, will be available in the destination branch mentioned in the Pull Request.
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s