Working on BitBucket using Git
Last Updated :
08 Oct, 2025
Bitbucket is a popular Git-based code hosting and collaboration platform developed by Atlassian. It allows developers to store, manage, and collaborate on projects efficiently using Git version control. By connecting Bitbucket with Git, teams can track changes, work on multiple branches, review code, and maintain clean, versioned repositories.
Working with BitBucket
- Now's let's see how we can work with the Bitbucket using git. It's pretty simple. You will need to create a repository first.
- Visit the link below and create an account at Bitbucket.
- After you have created your account, you will see a button "create repository" in the center of the screen, click it and create a repository.
- You can choose the repository to be private or public. public repositories are accessible to everyone while private is only accessible to you. Now we will get started with the Bitbucket.
We will need to clone the project folder into your local machine, which can be done in a few steps as shown below with visual aids
Step 1: Clone the repository into your local machine
Click on the "clone" button on the right corner of the dashboard. A prompt with the URL link would appear. the URL link would look like "https://[email protected]/USERNAME/REPOSITORY_NAME.git". You can clone using either https or ssh links.

Step 2: Copy and paste the link in the terminal after typing git clone.
Use the following commands to clone your repository as provided below as follows:
git clone (REPOSITORY URL)
git clone https://[email protected]/USERNAME/REPOSITORY_NAME.git

Now, we need to know what does clone means? Clone means, it will retrieve all the contents from that directory to your local machine where you are working, without affecting the Bitbucket repository, until you edit it from the terminal. Using git clone would add the folder to your local machine.
Step 3: Check your progress by typing "git status" command into the terminal
git status
Step 4: Creating and adding a file to your Bitbucket repository
Now, let's suppose you want to create and add a file to your Bitbucket Repository. Type in the commands below in the terminal.
echo "This is a test file" >> file.txt
git add file.txt

Step 5: Committing changes to BitBucket repository
The file is now added and is ready to be committed and pushed on your Bitbucket repository.
git commit -m "Initial Commit"
git push origin master // to push the changes on the Bitbucket repository.


If there are some changes made to your repository. You can use the git pull command to restore them to your local machine.
git pull
git pull origin master
git pull --all
Any of the three commands would restore the changes into your folder in the local machine.
Step 6: Performing operations on branches
As discussed, since this is a tool for working across separate branches, let's learn how to create, and delete a new branch, and how to switch across branches.
To create a branch, type in the terminal
git branch new_branch_name
git branch testbranch // to create a new branch named testbranch

To switch the branch, use the command git checkout:
git checkout new_branch_name
git checkout testbranch // to switch to a branch named testbranch
Finally, to merge your branch with the master branch, use the command git merge to merge the two branches.
git merge branch_name

Step 7: To delete a branch, use git branch -d to delete the branch.
git branch -d branch_name

In case you have an existing project, switch the current directory to that existing repository in the Terminal or CMD. Then type in the commands below in the terminal or CMD.
| Command | Action performed |
|---|
| git init | git initialization. |
| git add --all | This stages the newly added files and prepares them for commit. |
| git remote add origin (repository_url) | Use the https or ssh URL link from the bitbucket website to connect to remote Bitbucket repository that you want to add the folder into |
| git commit -m | Initial Commit |
| git push origin master | Push the files into your Bitbucket repository |
What is the purpose of the git clone command when working with BitBucket?
-
To delete a remote repository
-
To create a new branch in the repository
-
To download a copy of the repository to the local machine
-
To push commits to the BitBucket server
Explanation:
git clone downloads the entire repository and its history into the local system, allowing developers to work locally without modifying the original repo until changes are pushed.
Which command is used to check current changes and file status in a Git repository?
Explanation:
git status displays tracked/untracked files, staged changes, and current branch, helping developers monitor their progress.
Which of the following commands is used to upload committed changes to the BitBucket remote repository?
Explanation:
git push origin master sends local commits to the master branch on the remote BitBucket repository.
If you want to work on a separate feature without affecting main code, which operation is required?
-
-
-
Creating and switching to a new branch
-
Running git status repeatedly
Explanation:
Developers use branches to isolate features. Commands like git branch new_branch and git checkout new_branch enable working independently.
Which command correctly initializes an existing project folder for Git version control?
Explanation:
git init initializes a local folder as a Git repository, enabling further operations like add, commit, remote linking, and pushing.
Quiz Completed Successfully
Your Score : 2/5
Accuracy : 0%
Login to View Explanation
1/5
1/5
< Previous
Next >
Explore
Git Introduction
Git Installation and Setup
All Git Commands
Most Used Git Commands
Git Branch
Git Merge
Git Tools and Integration
Git Remote Repositories
Collaborating with Git
Advanced Git Commands