Sergey Nivens - Fotolia
Keeping track of application code is time-consuming, challenging and error-prone without the right tools. Using GitHub with Amazon Web Services is a popular repository that manages and shares code effectively. You can also use Git software to create a repository.
Git formalizes version control, eliminating the need to name files with version numbers or recreate the state of your code as it existed before you made the last known good changes. Git allows you to save versions along the way. It also streamlines sharing code with others.
A big advantage of Git is that collaborators can always get the latest good version of the code from a central repository. As long as you get into the habit of saving incremental and stable versions, collaborators will have access to those repositories.
Getting started with Git
After installing the software, the first step is to create a repository.
Use the "git init" command to create a new repository; this is basically a directory with a .git subdirectory. If you want to make a copy of an existing repository, you can simply copy or clone it with the "git clone" command. If you are using Git to version-control your own work, you might start with an empty Git repository. Then you can add files with the "git add" command; this tells Git to keep track of added files.
Once you've made changes to files, you can update a Git repository with the "git commit" command.
When you work with multiple repositories, it's typically a pull-and-push code method. A pull operation copies code from a remote Git repository and puts it in your repository. Push does the opposite: it puts a copy of your code in a remote repository.
Git also allows for branching, which makes logical copies of code so you can have multiple versions. This is useful for trying an idea and rolling back if it doesn't work.
About the author:
Dan Sullivan holds a Master of Science degree and is an author, systems architect and consultant with more than 20 years of IT experience. He has had engagements in advanced analytics, systems architecture, database design, enterprise security and business intelligence. He has worked in a broad range of industries, including financial services, manufacturing, pharmaceuticals, software development, government, retail and education. Dan has written extensively about topics that range from data warehousing, cloud computing and advanced analytics to security management, collaboration and text mining.
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
- Test your skills on these 10 Git quiz questions
Dig Deeper on AWS tools for development
Related Q&A from Dan Sullivan
Docker's recent upgrade introduced support for hardware signing and in the future, automated security analysis on Docker images. Expert Dan Sullivan ... Continue Reading
Cisco's new project Contiv automates operational policies for containerized applications in the cloud. Expert Dan Sullivan explains the benefits of ... Continue Reading
Dropbox API abused by attackers posing as legitimate users in a huge spear phishing campaign. Expert Dan Sullivan explains how to mitigate the risks ... Continue Reading
Have a question for an expert?
Please add a title for your question
Get answers from a TechTarget expert on whatever's puzzling you.