This sponsored post features a product relevant to our readers while meeting our editorial guidelines for being objective and educational.
The popularity of Git speaks for itself. If you're reading this article, hopefully you know that Git is the preferred source code management tool of many, many developers.
With the interest in Git growing when compared to other source code management systems, it's one of the most attractive options from which to choose especially if you're just getting into version control.
In this tutorial, we will talk about why you should be using Git regardless of if you are an individual or a part of a team of developers. We'll also teach you how to get started with Bitbucket, a premier repository hosting platform, for free.
Let's get started!
Git for the Individual
Git is an incredibly powerful tool with a lot of intricate, detailed features that make it useful for even individual developers. If you're looking to gain some kind of consistent control over code versions and revisions, Git is arguably the best solution for you.
Here are just a few of the things you can use git for as an individual:
- Git's popularity makes it very well-covered online; if you don't know how to do something, someone else has probably already documented how to do it.
- Git provides deployment tools like pushing and pulling code from one repository to another.
- Using Git protects you from overwriting your own repositories by using a traditional method like FTP directory uploading.
- Git provides a uniform way to stay organized; every commit you make creates a log entry, and you can view each and every message you've ever put into that log for a given project.
- You can work with amazing platforms like Bitbucket to track your changes, take notes, and make your code viewable to your clients or occasional contributors without giving them access to the production environment.
Git for the Team
Of course, the true muscle of Git is flexed when you are working within the context of a team. Git effectively eliminates the age-old problems of working on features in parallel to other developers, and in combination with Bitbucket, provides a complete workflow process to work faster and more efficiently than ever before.
Here are some of the most valuable features of git for teams:
- Avoid parallel code conflicts and overwriting of each others' work. This is arguably the most important feature of source code control.
- Keep feature development under control.
- Utilize branching to code without inhibitions. This allows you to build something from a base set of code and easily throw it away, or re-integrate it into the project's main branch.
- Git has proven to be effective for projects with hundreds and even thousands of active contributors.
- Unified workflow and standard way of moving code from one place to another.
- History of commits gives information to other developers about the granular status of a project or branch
The benefits of using Git with a team go far beyond this short list, but Git truly works best when used with supporting software, such as a dedicated repository hosting service.
For you to gain the maximum benefit from using Git, start using Bitbucket to host your repositories.
Why Use Bitbucket?
You may be wondering "why do I need a repository hosting service at all?"
Once you try it, you'll likely immediately realize the value, but to be clear, here are some of the major benefits of using Bitbucket for version control:
- Completely free, private repositories for up to five users. Start 1,000 projects for you and your team of four.
- Competitive pricing for more than five users.
- Mercurial support (if you opt for that over Git).
- Open Rest API to hack to your heart's content.
- Built by Atlassian; integrates with HipChat, Confluence, and a host of other tools used by companies like Nasa, Facebook, Netflix, and Cisco.
- Mac and PC native applications available.
- Issue tracking tied directly to your code.
- Visual code comparison tools.
- Add downloadable files directly in the browser.
- Teams, groups, access management, and many screens full of collaboration settings
- Configurable options like protected branches, automatic deployment keys, and username aliases.
- Importing and exporting issues.
- And many, many more features.
Ultimately, Bitbucket provides you a platform for managing both the metadata and access control for your project. It provides tools to explore not only what the source code currently is, but what it has been in the past and the plan for what it will become.
And, as stated, if you're a team of five or less, it's free.
Signing Up for Bitbucket
Signing up for Bitbucket is incredibly easy. Head over to the homepage and enter your details. If you need to go ahead and sign up your team, go to this page instead, and choose your plan from the dropdown menu.
Bitbucket's pricing model is pretty awesome, ringing in at $1 per user, per month. Public repositories are always free, and always have unlimited collaborators.
The pricing model is especially attractive if the number of your projects grows faster than the size of your team, especially if your company consults for project-to-project work. When your team grows, your budget also grows; however, old projects may not be bringing in money on a month-to-month basis, but they still need an accessible, up to date hosted repository. This is where Bitbucket truly shines with its no repository limits.
A Basic Tour of Bitbucket's Interface
When you first log into Bitbucket, you'll see a prompt to create a repository. You can either start fresh, or import from a number of existing repository services.
In the navigation menu at the top of the page, the Dashboard, Teams, and Repositories dropdowns each provide quick access to common views within those areas of functionality.
At the top right, you can see a search bar, a Help hover dropdown, and a Profile dropdown.
Create Your First Repository
Let's get started by creating a repository. We'll click on the "Create a Repository" button, and fill in our details. For the sake of this tutorial, we will also set the repository to private.
Once we've created the repository, we're presented with a screen that informs us that the repository is empty.
Now that our repository is ready to use, let's push some code to it.
If we click "I'm starting from scratch" under the headline "Command Line", we can see basic instructions to get our repository set up locally and ready to push.
cd my-secret-project ls git init git remote add origin https://firstname.lastname@example.org/jcutrell/my-secret-project.git echo "Jonathan Cutrell" >> contributors.txt git add contributors.txt git commit -am "Initial commit with contributors" git push -u origin master Password for 'https://email@example.com': Counting objects: 3, done. Writing objects: 100% (3/3), 256 bytes, done. Total 3 (delta 0), reused 0 (delta 0) To https://firstname.lastname@example.org/jcutrell/my-secret-project.git * [new branch] master -> master Branch master set up to track remote branch master from origin.
Once you've pushed your first commit, refresh your repository, and voilà! Just like that, your code is viewable; however, it is currently only viewable by you, so let's create a team.
Create Your First Team
Hover over Teams in the navigation and click the button in the drop down, Create a Team. Fill in the necessary details, and click create.
Bitbucket supports team repositories in addition to individual repositories.
Next, we'll need to associate your team with the repository settings so that users can access that repository. Click on Repositories in the navigation, and select your project.
Next, you'll click on Settings at the bottom of the left-hand sidebar navigation, and then click on Access Management near the top of the nested Settings menu. From here, you can choose a Group, which are sub-groups inside your group. We'll select Developers, change the access level to Write, and then click the Add button.
Now our team can view our repository.
Transfer Our First Repository to Our Team
If you'd like to transfer the repository to the team you just created or to another user, go to Settings > Transfer Repository, where you will be able to enter the name of the user or team to which you'd like to transfer the repository.
If you are transferring it to a team of which you are an administrator, Bitbucket immediately allows you to accept the transfer. Once that transfer has been made, your team page will now show the repository.
Source code management can be a daunting task, but with powerful tools like Git and Bitbucket, you can focus more on writing code, and less on managing the details of the project. Leaning on these free and low cost solutions will save you time, money, and headaches in the long run.
Ultimately, choosing a workflow is a personal decision, but be certain you consider the option of Git and Bitbucket. There's almost zero risk in trying it, but the potential positive effects are enormous.
Learn More About Git
Learn More About Bitbucket
Envato Tuts+ tutorials are translated into other languages by our community members—you can be involved too!Translate this post