git & GitHub

๐ Welcome to the world of Git and GitHub! ๐ Git is a powerful version control system that helps you track changes in your code, collaborate seamlessly, and manage your projects efficiently. ๐ก GitHub, on the other hand, is a web-based platform that adds a social and collaborative layer to Git. ๐ค Whether you're a developer, designer, or anyone working on a project, Git and GitHub will be your trusty companions in maintaining order and teamwork in your coding journey. Let's dive in and explore the magic of version control and collaboration! ๐๐ฉโ๐ป๐จโ๐ป
What is GIT?
Git is a distributed version control system designed to manage source code and track changes in projects. It was created by Linus Torvalds in 2005 and has become an essential tool in the software development industry. Git allows multiple individuals to collaborate on a project, making it easy to work on different features or fixes simultaneously without interfering with each other's work.
At its core, Git provides a way to:
Track Changes: Git keeps a history of every change made to a project, allowing developers to review and revert changes as needed.
Branching and Merging: Developers can create branches to work on specific features or fixes independently. Once the changes are ready, these branches can be merged back into the main codebase.
Collaboration: Git facilitates collaboration by enabling developers to work on their local copies of the code and then synchronize their changes with a central repository.
Versioning: Git allows for easy versioning of code, making it possible to see how the codebase has evolved.
What is GITHUB
GitHub is a web-based platform that provides hosting for software development and version control using Git. It enhances the collaborative aspect of Git by offering a user-friendly interface, social features, and tools that make it easier for individuals and teams to work together on projects. Created in 2008, GitHub has become one of the most popular platforms for open-source and private software development.
Key features of GitHub include:
Repository Hosting: GitHub allows you to create repositories (repos) to store your code and project files. These repositories can be public (visible to everyone) or private (visible only to collaborators you invite).
Version Control: GitHub uses Git as its underlying version control system, allowing you to track changes, manage branches, and collaborate on code seamlessly.
Collaboration: Developers can work together on the same project, whether it's open source or private, by cloning repositories, creating branches, making changes, and submitting pull requests for code review.
Pull Requests: Pull requests (PRs) are a core feature of GitHub. They enable contributors to propose changes from their branches to the main codebase, facilitating discussion, review, and approval before merging.
Let's delve into the tasks and understand how things work.
- Create a new repository on GitHub and clone it to your local machine
Log in to GitHub: if you don't have a GitHub account, you'll need to create one first https://github.com/ If you already have an account, log in.
Access Your Profile: Once logged in, you'll be on your GitHub dashboard. Click on your profile picture in the top-right corner to access your profile.
Create a New Repository: On your profile page, you'll see a green button labeled "New." Click on it to create a new repository and copy the repo URL.
Once completed, move over to your Terminal in the directory where you want to clone your remote repo. Initialize the new GIT repository in the directory with git init
git clone command with the remote repo URL tada

Make some changes to a file in the repository and commit them to the repository using Git
Open the cloned file and make the changes using the Vim command before staging do git status to make sure the files we are about to commit and followed by git add file name to stage the file and then Git status to check the file has been staged or not and then git commit command to track the file.

Push the changes back to the repository on GitHub:
Here comes the real part, to push changes to the remote repo we should first sync both the repos and to achieve that git remote set-url --add <name> <new url>
Once done delete the existing push URL with no password token by using the command git remote set-url --delete <name><url>

and once the repos are in sync the changes can be pushed to the remote repo using the command git push origin main

And there you have it, a glimpse into the dynamic duo of Git and GitHub! ๐ In a world where code is written like a symphony, these tools conduct the harmony of collaboration. ๐ผ So, keep committing, keep pushing, and keep exploring, for your code is now backed by the power of version control. โ๏ธ๐ถ
Happy Learning!!!


