Title: Demonstrating Version Control with Bitbucket
Objective:
The objective of this experiment is to showcase the basic functionalities of version control using Bitbucket. We will create a simple project, set up a Bitbucket repository, and perform version control operations such as creating branches, making changes, committing changes, and merging branches.
Tools and Technologies:
- Bitbucket (Cloud or Server)
- Git (command-line or Git GUI client)
- Web browser
Experiment Steps:
Step 1: Set Up Bitbucket Repository
- Create a Bitbucket account (if you don't have one) and log in.
- Create a new repository on Bitbucket with an appropriate name (e.g., "demo-project").
- Take note of the repository URL (HTTPS or SSH) provided by Bitbucket.
Step 2: Initialize the Project
- Create a new directory for the project on your local machine.
- Navigate to the project directory using the command-line.
- Initialize a Git repository in this directory using the command: git init.
Step 3: Configure Git Remote
- Set the Bitbucket repository as the remote for your local repository using the command:
git remote add origin <Bitbucket_Repository_URL>
Replace <Bitbucket_Repository_URL> with the URL obtained in Step 1.
Step 4: Create and Switch Branches
- Create a new branch called "feature-branch" using the command: git checkout -b feature-branch.
- Switch back to the main branch (usually "master" or "main") using: git checkout main.
Step 5: Make Changes and Commit
- Create a new file or modify an existing one in your project directory.
- Add the changes to the staging area using: git add <file_name>.
- Commit the changes with a descriptive message using: git commit -m "Your commit message".
Step 6: Push Changes to Bitbucket
- Push the committed changes to the Bitbucket repository using: git push origin <branch_name> (e.g., git push origin main).
Step 7: Merge Branches
- Switch to the main branch using: git checkout main.
- Merge the "feature-branch" into the main branch using: git merge feature-branch.
- Resolve any merge conflicts if they occur.
- Commit the merge changes and push them to the Bitbucket repository.
Step 8: Review History
- View the commit history using: git log.
- Use Bitbucket's web interface to visualize the commit history, branches, and pull requests.
Step 9: Optional - Collaborate with Others
- Invite collaborators to your Bitbucket repository.
- Ask collaborators to clone the repository, make changes, and push them to Bitbucket.
- Review and merge their changes using pull requests.
Conclusion:
This experiment demonstrates the fundamental version control operations using Bitbucket. By following these steps, you have gained an understanding of how to set up a repository, create branches, make changes, commit changes, merge branches, and collaborate with others using Bitbucket's version control capabilities. Version control is a critical aspect of modern software development, enabling teams to work together efficiently and maintain a history of changes to their projects.
Comments
Post a Comment