Delving into data science
Source: Dev.to
Introduction
This article will help you understand Git and GitHub, including terms like push, pull, tracking changes, and version control.
Installing Git Bash
Git Bash is a tool that allows you to interact with Git using simple commands. It serves as a channel through which you can communicate with GitHub.
To install Git Bash, visit GITBASH. Once installed, open Git Bash from your applications; a black terminal window will appear, ready for use.
Configuring Git with GitHub
After creating your account on GitHub, you need to configure Git Bash to work with GitHub:
- Open Git Bash.
- Run the necessary commands to generate an SSH key.
- Add the generated key to your GitHub account to establish a connection.
Pushing Code
Pushing code means making changes to a project locally and then sending those changes to GitHub. This step uploads your work to the online repository, providing a backup and enabling collaboration.
- After pushing, your code is safely stored online.
- If your computer fails or you switch devices, your work remains accessible on GitHub.
Pulling Code
Pulling code is the opposite of pushing. It means downloading the latest version of a project from GitHub to your computer.
Pulling is useful when:
- You are working on multiple devices.
- Someone else has updated the project.
Tracking Changes
Tracking changes involves checking which files have been modified, added, or deleted since the last save. Git continuously watches your project and records every difference.
Version Control
Version control is a system that records every change made to a project over time. Instead of saving multiple copies of the same file with different names, Git automatically keeps a history of all changes.
This allows you to:
- Go back to an earlier version of your work.
- See exactly what changed and when.
- Work safely without fear of losing progress.
Version control is especially important when working in a group, as it helps prevent overwriting each other’s work.