DEV Community

Victor
Victor

Posted on

Version Control

In the world of software, Version Control is an important infrastructure. Imagine having to write code without being able to track the changes. This is recipe for chaos.
Version Control exists to mitigate this allowing for efficient collaboration and help you undo mistakes.

So then, what is version control?

Version Control is a system for tracking changes to files e.g. code. Every time you make a change, Version Control records this and saves the outcome.

GIT

This is a Distributed Version Control System that helps track changes in code and allow collaborations between multiple people simultaneously.

GITHUB (Git + Collaboration)

GitHub is a cloud platform that hosts Git repositories and allows developers to collaborate through pull requests.
While Git is the tool, GitHub is the platform around it.
GitHub is crucial as it is your CV. Recruiters will always check it.

Push and Pull

These are operators for synchronizing code between your local computer( local repository) and the shared project space on GitHub( remote repository)

Git Push

This uploads your local changes to the remote repository making them available to collaborators.
How do you do this?
-Create new repository on GitHub and name it.
-Go to the file you need to push and initialize Git on it. Use the command git init
-Check the files you need to push using git status
-Add the files using git add
-Commit locally using git commit -m "Project added"
-Now push this code to Git repository. Commit the URL on GitHub and paste it on Git together with the command git remote add origin URL
-Then type git push origin master
-Your files will now appear on GitHub.

Git Pull

This fetches the latest changes to ensure your local copy is up to date.
How do you do this?
-Find the repository you need
-Fork the project. This is crucial as it creates a copy of the project and stores it on your GitHub. The changes you do here wont affect the original file
-Pull this project to your local machine by copying the URL ang going to Git Bash.
-After type git clone URL
-You can now make your desired changes before pushing them back to GitHub.

So, what is the summary of this article? Simple

  • Version Control makes sure the changes we make are safe
  • Git makes it distributed
  • GitHub allows for collaboration on these changes

Top comments (0)