{"id":25949722,"url":"https://github.com/rohit-2301/git-github_basics","last_synced_at":"2025-03-04T12:28:50.315Z","repository":{"id":279361023,"uuid":"938550679","full_name":"Rohit-2301/Git-Github_Basics","owner":"Rohit-2301","description":"This repository consists of basics of Git and Github","archived":false,"fork":false,"pushed_at":"2025-02-25T06:21:01.000Z","size":2,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-25T07:29:06.542Z","etag":null,"topics":["git","github"],"latest_commit_sha":null,"homepage":"","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Rohit-2301.png","metadata":{"files":{"readme":"README.MD","changelog":null,"contributing":null,"funding":null,"license":null,"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-02-25T06:07:34.000Z","updated_at":"2025-02-25T06:38:04.000Z","dependencies_parsed_at":"2025-02-25T07:29:08.844Z","dependency_job_id":"b0de7891-de7b-4b37-aeb3-fe7dafa75762","html_url":"https://github.com/Rohit-2301/Git-Github_Basics","commit_stats":null,"previous_names":["rohit-2301/git-github_basics"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rohit-2301%2FGit-Github_Basics","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rohit-2301%2FGit-Github_Basics/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rohit-2301%2FGit-Github_Basics/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rohit-2301%2FGit-Github_Basics/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Rohit-2301","download_url":"https://codeload.github.com/Rohit-2301/Git-Github_Basics/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241847325,"owners_count":20030232,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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"],"created_at":"2025-03-04T12:28:49.468Z","updated_at":"2025-03-04T12:28:50.309Z","avatar_url":"https://github.com/Rohit-2301.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# 🚀 Git \u0026 GitHub Basics  \n\nGit is a **version control system** that helps developers manage and track changes in their code, while GitHub is a **cloud-based platform** for hosting Git repositories and collaborating with others. This guide covers the essential Git commands and workflows to get you started.\n\n---\n\n## 📌 What is Git?  \n\nGit is a **distributed version control system** that allows multiple developers to work on a project efficiently, keeping track of changes and enabling easy collaboration.\n\n### 🔧 Basic Git Commands and Their Usage  \n\n| Command | Description |\n|---------|-------------|\n| `git init` | Initializes a new Git repository in your local project directory. |\n| `git clone \u003crepo_url\u003e` | Downloads (clones) a repository from GitHub to your local machine. |\n| `git status` | Shows the current state of your repository (modified, staged, or untracked files). |\n| `git add \u003cfile\u003e` | Adds a specific file to the staging area before committing. |\n| `git add .` | Stages all modified and new files in the repository. |\n| `git commit -m \"message\"` | Saves (commits) the staged changes with a meaningful message. |\n| `git push origin \u003cbranch\u003e` | Uploads (pushes) local commits to a remote GitHub repository on the specified branch. |\n| `git pull origin \u003cbranch\u003e` | Fetches and merges the latest changes from a remote repository into your local branch. |\n| `git log` | Displays a history of commits made in the repository. |\n| `git branch` | Lists all branches in the repository and highlights the current branch. |\n| `git checkout -b \u003cnew-branch\u003e` | Creates and switches to a new branch for feature development. |\n| `git merge \u003cbranch\u003e` | Merges changes from another branch into the current branch. |\n| `git reset --hard HEAD~1` | Removes the last commit permanently from history. |\n| `git revert \u003ccommit_id\u003e` | Creates a new commit that undoes a previous commit without modifying history. |\n| `git checkout -- \u003cfile\u003e` | Discards changes made to a specific file before committing. |\n| `git remote -v` | Displays the URLs of remote repositories linked to your project. |\n| `git stash` | Temporarily saves changes that are not yet committed, allowing you to switch branches. |\n| `git stash pop` | Restores the most recently stashed changes. |\n| `git rm \u003cfile\u003e` | Removes a file from the repository and deletes it from the working directory. |\n\n---\n\n## 📌 What is GitHub?  \n\nGitHub is a **web-based platform** that hosts Git repositories, making it easy for developers to collaborate on projects, track issues, and review code.\n\n### 🔗 Basic GitHub Workflow  \n\n1. **Create a Repository**  \n   - Go to [GitHub](https://github.com) → Click **New Repository** → Enter a name → Click **Create Repository**  \n\n2. **Clone the Repository (Download it Locally)**  \n   ```sh\n   git clone \u003crepo_url\u003e\n   cd \u003crepo_name\u003e\n\n## 📌 Steps to Add a File to GitHub Using Git \u0026 VS Code  \n\nFollow these steps to add and upload a new file to your GitHub repository:\n\n### ✅ Step 1: Open Your Project in VS Code  \n- Open **VS Code** and navigate to your project folder.\n\n### ✅ Step 2: Create or Add a File  \n- Add a new file or modify an existing file in the project directory.\n\n### ✅ Step 3: Open Terminal in VS Code  \n- Open the **terminal** (`Ctrl + ~` on Windows/Linux or `Cmd + ~` on Mac).\n\n### ✅ Step 4: Check the Status of Your Repository  \n```sh\ngit status\n```\n- This shows any new, modified, or deleted files.\n\n### ✅ Step 5: Add the File to Staging Area  \n```sh\ngit add \u003cfilename\u003e  # Adds a specific file\ngit add .  # Adds all new and modified files\n```\n\n### ✅ Step 6: Commit the Changes  \n```sh\ngit commit -m \"Added \u003cfilename\u003e\"\n```\n- Write a meaningful commit message describing the change.\n\n### ✅ Step 7: Push the Changes to GitHub  \n```sh\ngit push origin main\n```\n- If you're working on a different branch, replace `main` with your branch name.\n\n### ✅ Step 8: Verify on GitHub  \n- Go to your **GitHub repository** and check if the file is uploaded.\n\n---\n\n🚀 **Now your file is successfully added to GitHub!** 🎉\n\n---\n\n## 📌 Steps to Remove a File from GitHub Using Git \u0026 VS Code  \n\nFollow these steps to remove a file from your GitHub repository:\n\n### ✅ Step 1: Open Your Project in VS Code  \n- Open **VS Code** and navigate to your project folder.\n\n### ✅ Step 2: Open Terminal in VS Code  \n- Open the **terminal** (`Ctrl + ~` on Windows/Linux or `Cmd + ~` on Mac).\n\n### ✅ Step 3: Remove the File  \n```sh\ngit rm \u003cfilename\u003e\n```\n- This removes the file from your local repository.\n\n### ✅ Step 4: Check the Status of Your Repository  \n```sh\ngit status\n```\n- Verify that the file is marked as deleted.\n\n### ✅ Step 5: Commit the Changes  \n```sh\ngit commit -m \"Removed \u003cfilename\u003e\"\n```\n- Write a meaningful commit message describing the removal.\n\n### ✅ Step 6: Push the Changes to GitHub  \n```sh\ngit push origin main\n```\n- If you're working on a different branch, replace `main` with your branch name.\n\n### ✅ Step 7: Verify on GitHub  \n- Go to your **GitHub repository** and check if the file is removed.\n\n---\n\n🚀 **Now your file is successfully removed from GitHub!** 🗑️\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frohit-2301%2Fgit-github_basics","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frohit-2301%2Fgit-github_basics","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frohit-2301%2Fgit-github_basics/lists"}