🕗 Collaborating with Git
In software development, collaboration is essential. While you can make a project from start to end all by yourself, working in a team is going to help from both a timing and an experience perspective. Splitting work between people, collaborating and debugging is made a lot easier if using software that is designed for this.
What is Git ?
The most popular software for collaboration is Git. Git is an implementation of a VCS, or Version Control System. There is a great in-depth tutorial on Git over at Atlassian.com, but for basic use you only need to know a few things:
- Git uses SSH for authentication. If you don't know what SSH is or how it works, check out this tutorial.
- Code in Git is stored in a repository. The repository is a collection of files and information about them.
- A commit in Git is a set of changes that you have made to a file. Git stores all of your commits. This allows you to "go back in time", and see how your files changed and revert to an older version if needed
- A branch is a string of commits that start from one main one, kind of like branches of a train track. And just like train tracks, branches can go back into the main branch they came from. This process is called merging
Git is a decentralized system. What this means is that each developer you collaborate with has its own copy of the project. When you sync your changes with the other developers, Git applies your commits to the common code shared with the rest of your team.
Be careful not to mix Git and services such as GitLab, GitHub or Bitbucket. These services are simply a Git client with a graphical user interface, and you can just as easily set up a similar service on your personal computer.
There are a couple of commands that you will most likely use daily with Git:
git pull- retrieve changes from other developers and sync them locally
git status- get information about a repository, and show any changes that have not been committed yet
git add .- add currently modified files to a new commit (note the
.after add - this specifies all files. You can replace this with a certain filename to commit only one file)
git commit -m 'This is a commit'- creates a new commit with the message
This is a commit
git push- sends all your local commits to the central server
Services such as GitLab, GitHub or Bitbucket offer, in your repository, a feature called Issues. These function as tasks for your project, and can be assigned to people and be labeled with different states, such as
done. You can learn more about issues here