Andrea Danti - Fotolia
Every developer knows the importance of version control systems, and Git has become the most popular version-control system.
Git is popular because it's decentralized, meaning that every computer that stores the repository can act completely independent of other repositories, but can still synchronize with other systems. Basically, that means that even if a developer is offline, he can still do everything he could when online, like commit new changes, revert changes and even see differences between changes. It also means that every computer that has a copy of the repository is essentially a full backup of all of your code, making it a great backup system.
Git also introduces branches of code, providing one pointer to the production version of the code, one for the current development version of code, and one for each major feature being worked on. Once a developer completes a feature branch, he can merge those changes into the development branch to test and then create a release branch from the development branch. Once that release is finished and tested, the developer can merge it into the master branch -- or production branch -- which then signals that's it's ready to be deployed to production servers. This method, called "git-flow," is popular among development teams working on large projects because it helps keep code organized while making it easy to revert changes in the event of an error.
Synchronizing changes in Git on AWS
A developer can use Git without a centralized server, but that makes it much harder to share code with other developers. Additionally, developers working on more than one computer may want to synchronize changes among them. It's also a good idea to be able to back up code in case something goes wrong, such as a computer error. For this reason, developers may use one of these three popular managed Git centralized servers, including GitHub, Bitbucket and AWS CodeCommit, among many others. Let's take an in-depth look at these three servers, their features and their differences.
Automating with GitHub
GitHub offers a centralized location to synchronize changes with other developers. Developers can push their changes to the GitHub server and pull other's changes from it. This is the standard form of a Git server, and is offered by both GitHub and AWS CodeCommit. GitHub has the advantage over AWS CodeCommit because it can integrate things such as forks, issues, visual change logs, merge requests and integration with third-party services like Travis CI, Maven, Jenkins CI and other Continuous Integration (CI) platforms.
Learn Git Fast
New to Git and distributed version control? Here are some Git examples and Jenkins-Git integration tutorials designed to help you master the popular source code versioning tool.
- The five key Git commands to master first
- Change a commit and manipulate commit history with this hard git reset example
- What happens when you git reset and push?
- Learn to undo a commit with git revert
- Use the git cherry-pick command across branches
- Change the default Git commit editor to Notepad++
- Where the Git configuration files are stored
- Make continuous integration part of your DevOps journey with this Jenkins CI tutorial
- Include Jenkins Git environment variables in your freestyle builds
Pairing this with CI services gives developers something AWS CodeCommit does not -- the ability to automate deployments by committing to the repository in a specific branch. It also allows developers to automatically test code and show a "build status" on the project page.
GitHub is free for public repositories and is the primary code repository system for most open source projects. For companies looking to host their private repositories on GitHub, it can cost about $25 for up to 10 private repositories.
Bitbucket might be the tool for the job
Bitbucket is nearly identical to GitHub, except that it also supports the Mercurial code repository system. It started out running its servers entirely on AWS; however, it has since moved off to other providers. Bitbucket offers integration with third-party services like CI systems; it is owned by Atlassian, which runs some of the most popular development tools, such as JIRA, Confluence and HipChat. As such, it easily integrates with all of those tools, making Bitbucket a strong option for developers working with the Atlassian toolset.
As with GitHub, Bitbucket offers free unlimited public repositories for open source projects. However, Bitbucket charges per developer with access to the repository. Its smallest plan costs $10 for 10 users; the maximum cost is $200 for unlimited users. The big advantage is that if a business has fewer than five users, it can have an unlimited number of private repositories and not pay anything. This makes Bitbucket suitable for small startup teams that don't want to spend any money on an AWS code repository.
AWS CodeCommit eases Git on AWS
At re:Invent 2015, Amazon announced AWS CodeCommit, its version of a centralized server for synchronizing repositories for Git on AWS. Because it's new it doesn't have any direct integration with other services like Maven, Travis CI, Jenkins or even issue-tracking systems. It isn't a full development system; it's currently just a place that developers can push changes to and pull them from.
It's likely that AWS CodeCommit will become fully integrated with other services such as AWS Elastic Beanstalk. In this case, a developer could set up a new Beanstalk instance with the command "Use the code from this branch," and the Beanstalk instance automatically updates when changes are pushed to it. After all, developers can already push changes to Beanstalk through the Git command-line tool using "git aws.push".
Until then, the AWS code repository, CodeCommit, is good for teams developing internal code that doesn't need all the frills that come with either Bitbucket or GitHub. It is certainly much easier then running your own server for Git on AWS.
Similar to Bitbucket, AWS CodeCommit charges per user; however, it also charges for push/pull requests and storage. The free usage tier offers up to five users, 50 GB per month of storage and 10,000 Git requests per month -- after that a company is charged overages for extra use. Each additional user is only $1 though, and adds an additional 10GB and 2,000 Git requests to your quotas.
The right choice for your team
For new IT teams, Bitbucket makes sense, as it's the cheapest option and offers integration with development tools from Atlassian. GitHub is a strong option for teams focusing on open source applications, while a developer waiting on new features from Amazon, or generally wants more control and protection for his AWS code repository, should look to AWS CodeCommit.
Whatever AWS code repository an IT team chooses, it's incredibly easy to switch between centralized servers -- just point the developers to the new addresses. The SourceTree project from Atlassian also helps with visual merges for conflicts and has full support for git-flow.
Learn more about the industry's most popular DevOps tools
If you want to become a DevOps engineer, you'll need to master a variety of DevOps tools. Here are some popular tutorials to get you closer to achieving DevOps mastery:
- A step-by-step Jenkins CI tutorial with examples
- Learn how to install and configure JFrog Artifactory and integrate Artifactory with Jenkins
- Learn how to use the SonarQube Maven plugin to inspect for code quality
- Test your job readiness with these Jenkins and DevOps interview questions
- Some tough, sample GitHub and Git interview questions
- Learn the benefits of continuous integration by working with these popular CI/CD tools