{"id":26981185,"url":"https://github.com/narsibhati-dev/master-git","last_synced_at":"2026-02-14T11:08:02.022Z","repository":{"id":272636260,"uuid":"917186582","full_name":"NarsiBhati-Dev/master-git","owner":"NarsiBhati-Dev","description":"Master Git: From Fundamentals to Advanced Topics","archived":false,"fork":false,"pushed_at":"2025-01-31T07:32:26.000Z","size":948,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-03T15:44:58.885Z","etag":null,"topics":["git","github","github-config","software-development"],"latest_commit_sha":null,"homepage":"https://narsibhati.hashnode.dev/series/git-master","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/NarsiBhati-Dev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-01-15T14:19:02.000Z","updated_at":"2025-01-31T07:32:29.000Z","dependencies_parsed_at":"2025-11-24T01:03:29.666Z","dependency_job_id":null,"html_url":"https://github.com/NarsiBhati-Dev/master-git","commit_stats":null,"previous_names":["narsibhati-dev/master-git"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/NarsiBhati-Dev/master-git","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NarsiBhati-Dev%2Fmaster-git","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NarsiBhati-Dev%2Fmaster-git/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NarsiBhati-Dev%2Fmaster-git/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NarsiBhati-Dev%2Fmaster-git/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/NarsiBhati-Dev","download_url":"https://codeload.github.com/NarsiBhati-Dev/master-git/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NarsiBhati-Dev%2Fmaster-git/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29443447,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-14T10:51:12.367Z","status":"ssl_error","status_checked_at":"2026-02-14T10:50:52.088Z","response_time":53,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["git","github","github-config","software-development"],"created_at":"2025-04-03T15:33:13.614Z","updated_at":"2026-02-14T11:08:02.005Z","avatar_url":"https://github.com/NarsiBhati-Dev.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# Mastering Git: A Beginner's Guide to Version Control\n\n![banner](./images/master-git.jpeg)\n\n## Introduction\n\nVersion control is an essential skill for developers, and **Git** is one of the most powerful tools available. Whether you're working solo or collaborating with a team, Git helps track changes, manage code versions, and streamline workflows. In this guide, we'll explore Git from the ground up, covering installation, basic commands, and best practices.\n\n---\n\n## Why Learn Git?\n\n**Git** is a **distributed version control system** that allows you to:\n\n✅ Track changes to your code over time.\n\n✅ Collaborate with other developers efficiently.\n\n✅ Work on different features simultaneously using branches.\n\n✅ Revert to previous versions if something goes wrong.\n\n✅ Manage project history with structured commit messages.\n\nMastering Git will help you **become a more productive and efficient developer**. Let's get started!\n\n---\n\n## 📌 Installing Git\n\nBefore using Git, you need to install it on your system.\n\n### Windows / Linux (Ubuntu)\n\n```bash\nsudo apt install git-all\n```\n\n### MacOS\n\n```bash\nbrew install git\n```\n\nAfter installation, verify your Git version:\n\n```bash\ngit --version\n```\n\nIf everything is set up correctly, you should see the installed version number.\n\n---\n\n## 📌 Configuring Git\n\nBefore using Git, set up your user identity:\n\n```bash\ngit config --global user.name \"Your Name\"\ngit config --global user.email \"your.email@example.com\"\n```\n\nTo check your configuration:\n\n```bash\ngit config --list\n```\n\nSet a default branch:\n\n```bash\ngit config --global init.defaultBranch main\n```\n\nNow your Git environment is ready to go!\n\n---\n\n## 📌 Getting Started with Git Commands\n\n### 1️⃣ Cloning a Repository\n\nTo create a local copy of a remote repository:\n\n```bash\ngit clone \u003crepository-url\u003e\n```\n\n**Example:**\n\n```bash\ngit clone https://github.com/user/repository.git\n```\n\n### 2️⃣ Checking the Status of Files\n\nTo see which files have been modified, added, or deleted:\n\n```bash\ngit status\n```\n\n### 3️⃣ Adding Changes to Staging\n\nBefore committing, you need to stage your changes:\n\n```bash\ngit add \u003cfilename\u003e\n```\n\nTo add all changes at once:\n\n```bash\ngit add .\n```\n\n### 4️⃣ Committing Changes\n\nAfter staging files, commit them with a descriptive message:\n\n```bash\ngit commit -m \"Your commit message here\"\n```\n\n### 5️⃣ Pushing Changes to a Remote Repository\n\nOnce committed, push your changes to GitHub/GitLab:\n\n```bash\ngit push origin main\n```\n\nFor a different branch:\n\n```bash\ngit push -u origin \u003cbranch-name\u003e\n```\n\n### 6️⃣ Pulling Changes from Remote Repository\n\nTo sync your local branch with the latest remote changes:\n\n```bash\ngit pull origin \u003cbranch-name\u003e\n```\n\n### 7️⃣ Working with Branches\n\n**Check available branches:**\n\n```bash\ngit branch\n```\n\n**Create a new branch:**\n\n```bash\ngit checkout -b new-feature\n```\n\n**Switch to another branch:**\n\n```bash\ngit checkout \u003cbranch-name\u003e\n```\n\n**Delete a branch:**\n\n```bash\ngit branch -d \u003cbranch-name\u003e\n```\n\n### 8️⃣ Viewing Commit History\n\nTo see past commits:\n\n```bash\ngit log --oneline\n```\n\nTo view the commit differences:\n\n```bash\ngit diff\n```\n\n### 9️⃣ Undoing Changes\n\nReset to a previous commit without deleting changes:\n\n```bash\ngit reset --mixed \u003ccommit-hash\u003e\n```\n\nUndo the last commit but keep changes staged:\n\n```bash\ngit reset --soft HEAD~1\n```\n\nTo completely remove changes after a commit:\n\n```bash\ngit reset --hard \u003ccommit-hash\u003e\n```\n\n---\n\n## 📌 Merging and Handling Merge Conflicts\n\n### **Merging Branches**\n\nTo merge a branch into the current branch:\n\n```bash\ngit merge \u003cbranch-name\u003e\n```\n\nIf conflicts arise:\n\n1. Identify conflicting files using:\n\n   ```bash\n       git status\n   ```\n\n2. Manually edit the conflicted files.\n3. Stage the resolved files:\n\n   ```bash\n       git add \u003cfilename\u003e\n   ```\n\n4. Complete the merge:\n\n   ```bash\n     git commit -m \"Resolved merge conflict\"\n   ```\n\nIf you want to **abort the merge**:\n\n```bash\ngit merge --abort\n```\n\n---\n\n## 📌 Writing Better Commit Messages\n\nTo maintain clean commit history, follow these best practices:\n\n✅ Use the **imperative mood** (e.g., \"Fix bug\" instead of \"Fixed bug\").\n✅ Keep the subject line **under 50 characters**.\n✅ Provide detailed explanations when necessary.\n\n**Example of a good commit message:**\n\n```bash\ngit commit -m \"Refactor user authentication module to improve security\"\n```\n\n---\n\n## 📌 Creating and Managing Pull Requests (PRs)\n\nA **pull request (PR)** allows you to propose changes before merging them into the main branch.\n\n### **Steps to Create a PR:**\n\n1️⃣ Push your feature branch to GitHub:\n\n```bash\ngit push origin feature-branch\n```\n\n2️⃣ Go to **GitHub/GitLab/Bitbucket** and create a **Pull Request (PR)**.\n3️⃣ Add a descriptive title and explanation.\n4️⃣ Request reviews from team members.\n5️⃣ Address feedback and make necessary changes.\n6️⃣ Merge the PR once approved.\n\n---\n\n## 📌 Handling Issues and Merge Conflicts\n\n**Tracking Issues:**\n\n- Use GitHub Issues to track bugs and features.\n- Assign labels and milestones for better organization.\n\n**Fixing Merge Conflicts:**\n\n1. Identify conflicting files.\n2. Manually edit conflicts.\n3. Stage, commit, and push the resolved changes.\n\nBy following these best practices, you can efficiently collaborate with your team and maintain a structured workflow.\n\n---\n\n## 🎯 Conclusion\n\nMastering Git is a crucial skill for any developer. By understanding its core concepts and practicing these commands, you'll be able to **manage projects more effectively, collaborate seamlessly, and maintain a clean codebase**.\n\n🚀 **Start using Git today and take control of your development workflow!** 🚀\n\n---\n\nIf you found this guide helpful, leave a ⭐ on the repository and share it with fellow developers!\n\nHappy Coding! 😊\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnarsibhati-dev%2Fmaster-git","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnarsibhati-dev%2Fmaster-git","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnarsibhati-dev%2Fmaster-git/lists"}