Version control
This is a system that enables tracking changes made to files over time.It enables collaboration between people working on same projects without interfering with each other's work.Git and GitHub are essential tools in version control.
Git A version control system used to track changes made on files and also allows collaboration of teams dealing with same projects by recording every change made.
Git Bash It allows Windows users to fully utilise Git by acting as a command line.
GitHub An online platform that works with Git to manage and share code.It allows for many people to work on the same project without conflicts. It acts as a backup for projects being done and allows sharing projects with others.
Setting up git
On Windows Git Bash is used as a command line for Git.The following commands are used to configure your user name and email.
git config --global user.name"name"
git config --global user.email"email address"
The process of creating a folder and adding it to Git
Action Command
Create folder mkdir folder_name
Enter folder cd folder_name
Go back cd ..
Create file touch file.txt
Check location pwd
Check git status git status
Add to git git add folder_name
Commit git commit -m "message"
Initialising Git
Once you create a project folder initialise Git using this command
git init
Adding files to be tracked
Use this command git add filename
Pushing code to Git Hub
This is the process of uploading changes made on your projects from your computer to an online platform including GitHub and Git Lab.It is important because it enables you to share your work with your teammates,it updates the project repository with the latest changes and also keeps a backup of your work online.
Commands to push code
- Add files to staging area This is choosing what changes of your code or project you want saved.It is done using this command
git add filename
git add .
- Committing your changes This involves saving a clear snapshot of your project for easy collaboration,tracking progress and avoiding mistakes.The following command is used
git commit -m "a description of what you changed"
- Pushing changes to a remote repository Involves sending changes saved(commits)from your computer to a remote repository (GitHub).Done using this command
git remote add origin git@gitHub.com:username/repo-name.git
push your changes to GitHub
git push -u origin main
Pulling code
This is the process of downloading latest changes made on your project from an online repository to you computer(local).
Done using this command
git pull
Conclusion
Understanding version control system is very important for data scientists and analysts.Git and GitHub enable data analysts to effectively manage their projects and share their work with others.
Top comments (0)