This article aims to provide a quick understanding of how Git works using concepts and visualizations. This article is only meant for those who want to start collaborating as fast as possible. Only minimal executions are provided, as there are various methods to perform operations. Two primary methods include using the Git CLI or GitHub Desktop, both of which are available for download
I recommend GitHub Desktop if you want to start collaborating as fast as possible in your small team as it provides a way to do various Git commands without remembering their exact text command. Other developers don’t need to get GitHub desktop and this is purely preferential to each person.
Repository
refers to a folder/place where your project is kept. Repositories also contains list of changes that makes up the content of the repository. It knows the steps needed to reach the current state of the project. However, if repositories are cloned (or copied) to another place, it is not synchronized and needed to be “pushed” to keep one or the other up to date.
Git vs GitHub
Git is the tool that tracks changes on your code
GitHub is a website that hosts many git repositories where it makes it easy to collaborate with other people and organize projects into a portfolio
git clone
Use this command to bring a repository that is hosted somewhere (like GitHub) into a folder on your local machine
git add
When I’ve updated files, created or deleted files and folders, use this command to tell Git to track the changes in Git.
git commit
Once ready to finalize the changes, you can commit the changes so that it is saved in the Git. Use this command to save the changes into Git.
git push
Once you ready, you can then use this command to upload your files (only the changes) to a remote repository (like GitHub)
git pull
When there are changes in the code in GitHub, and you want to bring it to local machine, you can use this command to “pull down” the changes from the remote repository.