Getting into Git
What is Git?
Git is a software that tracks changes across a set of files, and is used in coordinating work among programmers simultaneously working on different parts of the same project. Git manages changes that were made so you can return to a previous point of your code, save new things you were working on that you haven’t completed, and update what you’re working on with the changes someone else made, among many other things we’ll get into.
Why use Git?
Git is currently the most commonly used version control system.
* In teams with multiple developers git will likely be used as it makes it easy to collaborate and merge changes.
* If you work independently but not always on the same computer: it allows you to easily retrieve changes you made on your other system as well as keep track of when you did what.
* You have the ability to go back to a previous version of the code in the case of changes you (or someone else) made ‘breaking’ the project.
* Or marking what changes were made that broke it so you can focus on just what was changed instead of the entire code.
How to use git?
Before you can start using git, you will need to install it. Check out the documentation for details
After initializing git on a set of files, you’ll want to set up your files with a repository that can manage your code for you on a location that isn’t your device.
Using a remote repository will give you more freedom to collaborate with others, set up hosting for your code, and share your code for use or as a portfolio.
Generally you’ll find with git you’ll stage changes that were made and push them to update your main branch in the repository. When you have more things you want to work on or have additional people working on the same code base you’ll want to use branches. I’ll be writing more going over the specific commands and how to use them in more detail in later posts!
Remote Repository?
Repositories are central locations where data is stored and managed. Having locations other than your device will give you more protection to save your data in the case anything happens to your device.
With git, there are a lot of hosts you can use for the repositories: often at no cost. Some you might run into include:
* GitHub
* GitLab
* BitBucket
* SourceForge
* LaunchPad
* Phabricator
There are also Self-Hosted solutions to host your repository including:
* Gogs
* Gitea
* Apache Alura
There’s no need to work with just one either. Try a few, and see what works for you. Git commands will be the same no matter which repository you use. Graphic User Interface (GUI) does change depending on what you’re using, but once you have a handle on one it will be easy to switch over to another host if you need (or want) to later.