Hi everyone! I hope you are all doing well and in good health. I apologize for the delay in posting as I have been very busy with my academics .In my last post I mentioned my PHP Laravel internship and today I thought of sharing a guide on how to use Git and GitHub. The goal of this post is to share and spread the knowledge I am currently getting from my internship.
Let's start with a basic introduction to Git and GitHub.
Need and Concept of Git and GitHub
When you enter the world of computer science one thing to remember is TEAMWORK. you will often find yourself working with a team on large or small scale projects. When a large project is assigned to a team, working at the same time was not possible for everyone so splitting the code into smaller chunks is a common practice.But the main Problem was dealing with different coding styles and logic, which can become problematic when combining code. To solve this issue tools like Git and GitHub have been created. They make it easier to work collaboratively, divide tasks, and keep the process error free.
What Is GitHub And Git
Git is actively maintained open source revision control system used by developer to manage the cource code . And GitHub on is a web based platform that hosts Git repositories. It provides a user friendly interface and features, like issue tracking, project management, and collaboration tools, making it easier for teams to work together on projects from anywhere in the world.
Setup And Login
Since github is a web base platform so you dont need to download it You just need to create an account, which is very easy to do. You can follow any YouTube tutorial for guidance.secondly to run them you need to download git from google and also login in with the same account you made for github.
Main Components
What are Repositories
After logging in to github lets consider you have been given a large project, such as a school management system. You would create a repository which is a storage space where your code your files can be save .
What is Issues And Branches
When a repository is created, it provides an option for splitting work using issues and branches. An issue is created and assigned to a team member, allowing them to work on a separate branch. This approach helps prevent conflicts in code or logic, making it easier to complete tasks efficiently.
Git Commands
now lets move towards the git and their commands . To run these command you have to use the downloaded git bash on your window
Clone Command
the clone command is used to make a copy of code into you laptop /Pc here is the basic syntax
git clone <repository-url>
Now in this copy you cann do all your work according to your need .
Git Checkout Command
git checkout command used to check the current issue you are workin on or to move you on the desired issue
Add , Commit And Push Command
These three commands are important when you are done with your code. They allow you to add your branch code to GitHub main branch
git add . (This command stages all the changes you have made to your code.)
git commit (This command records your changes with a descriptive message explaining what you have done.)
git push (This final command pushes your committed changes to GitHub.)
Conclusion
As a fresher I always faced challenges learning these commands and understanding the concepts. but now that I am working with a team i have realized that my difficulties stemmed from a lack of understanding. Once you learn and understand the basics, Git and GitHub are easy and efficient tools for collaborative coding. this post covers some of the main components of GitHub, not a full tutorial. I hope it will be helpful for students to gain clarity and confidence in using these tools.