{"id":23073689,"url":"https://github.com/akashdip2001/git-github","last_synced_at":"2025-08-15T16:31:22.763Z","repository":{"id":238912824,"uuid":"797949913","full_name":"akashdip2001/git-github","owner":"akashdip2001","description":"All important commands using in git-GitHub || solve merge conflict between Vs-Code \u0026 GitHub-web-editor","archived":false,"fork":false,"pushed_at":"2024-12-11T08:15:55.000Z","size":3580,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-12-11T08:25:23.487Z","etag":null,"topics":["git","git-github-vscode-setup","github","github-cloud-migrated","github-config","merge-conflict","vscode","vscode-git","vscode-github"],"latest_commit_sha":null,"homepage":"https://akashdip2001.github.io/git-github/","language":"HTML","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/akashdip2001.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":"2024-05-08T19:44:24.000Z","updated_at":"2024-12-11T08:15:59.000Z","dependencies_parsed_at":"2024-09-15T05:19:26.667Z","dependency_job_id":"983a0d82-5b38-4eeb-9c6c-676dcd330b39","html_url":"https://github.com/akashdip2001/git-github","commit_stats":null,"previous_names":["akashdip2001/git-github"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akashdip2001%2Fgit-github","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akashdip2001%2Fgit-github/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akashdip2001%2Fgit-github/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akashdip2001%2Fgit-github/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/akashdip2001","download_url":"https://codeload.github.com/akashdip2001/git-github/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":229927360,"owners_count":18145906,"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","git-github-vscode-setup","github","github-cloud-migrated","github-config","merge-conflict","vscode","vscode-git","vscode-github"],"created_at":"2024-12-16T08:18:44.878Z","updated_at":"2025-08-15T16:31:22.755Z","avatar_url":"https://github.com/akashdip2001.png","language":"HTML","readme":"\u003cimg align=\"right\" alt=\"github_logo\" width=\"400\" src=\"source/git\u0026github.png\"\u003e \n\n# Git \u0026 GitHub: Essential Commands\n\n| 🔭 [**my website**](https://akashdip2001.github.io/linktree/) | [Git docs.](https://docs.chaicode.com/git-and-github/) | [Exams MCQ](./Exam/1%20github%20foundations%20certification/readme.md) |\n| --- | --- | --- |\n\n| [\u003cimg src=\"https://user-images.githubusercontent.com/81384987/209952974-0163b04e-ccae-4be5-844a-075ef85c43d2.png\" height=\"15\" width=\"20\"/\u003e My YouTube Channel](https://www.youtube.com/c/akashaot) |\n| --- |\n\n---\n\n\u003cdiv style='display:flex; align-items:center; gap: 30px;' align='center'\u003e\n\u003ca href=\"https://www.credly.com/badges/b6fecf8a-dc7b-47f5-8275-0df8d829aeed/public_url\"\u003e\u003cimg src=\"https://github.com/user-attachments/assets/83d9db6e-b5e8-4b19-9878-b32559d86aca\" width=\"140px\" height=\"140px\" /\u003e\u003c/a\u003e\n\u003ca href=\"https://www.linkedin.com/posts/akashdip2001_macbook-desktop-github-activity-7286721666125119488-G-B4\"\u003e\u003cimg src=\"https://github.com/akashdip2001/akashdip2001/raw/main/img/Badge/github-actions.png\" width=\"155px\" height=\"155px\" /\u003e\u003c/a\u003e\n\u003ca href=\"https://www.linkedin.com/posts/akashdip2001_postman-api-certification-activity-7264947968200368128-MHWG\"\u003e\u003cimg src=\"https://github.com/akashdip2001/akashdip2001/raw/main/img/Badge/Postman%20White%20badge.png\" width=\"130px\" height=\"130px\" /\u003e\u003c/a\u003e\n\u003ca href=\"https://www.credly.com/badges/998c7f5e-7081-4cd7-b8ee-153ece4d89f0/public_url\"\u003e\u003cimg src=\"https://github.com/akashdip2001/akashdip2001/raw/main/img/Badge/aws-educate-introduction-to-cloud-101.png\" width=\"130px\" height=\"130px\" /\u003e\u003c/a\u003e\n\u003ca href=\"https://www.credly.com/badges/998c7f5e-7081-4cd7-b8ee-153ece4d89f0/public_url\"\u003e\u003cimg src=\"https://github.com/akashdip2001/akashdip2001/raw/main/img/Badge/aws-cloud-quest-cloud-practitioner.png\" width=\"150px\" height=\"150px\" /\u003e\u003c/a\u003e \u0026nbsp; \u0026nbsp;\n\n\u003cdetails\u003e\n  \u003csummary style=\"opacity: 0.85;\"\u003e\u003cb\u003emore Badges 🥇\u003c/b\u003e\u003c/summary\u003e\u003cbr\u003e\n  \u003cdiv style=\"display: flex; align-items: center; gap: 10px;\" align=\"center\"\u003e\n\u003ca href=\"https://ti-user-certificates.s3.amazonaws.com/72109ec1-52dd-4663-9df4-754a8a1d0bff/b3a9ea05-0814-405b-976d-3d150fd56bad-akashdip-mahapatra-f1f2d132-53f4-47fc-b401-7ec7b0e76a62-certificate.pdf\"\u003e\u003cimg src=\"./Exam/03 GitLab 101/GitLab 101.png\" width=\"125px\" height=\"125px\" /\u003e\u003c/a\u003e\n\u003ca href=\"https://www.credly.com/go/6C69ZOKh\"\u003e\u003cimg src=\"https://github.com/akashdip2001/akashdip2001/raw/main/img/Badge/github-foundations.png\" width=\"140px\" height=\"140px\" /\u003e\u003c/a\u003e\n\u003ca href=\"https://www.linkedin.com/posts/akashdip2001_github-copilot-exam-activity-7329820228555538432-6DzF\"\u003e\u003cimg src=\"https://github.com/akashdip2001/git-github/raw/main/Exam/06%20GitHub%20Copilot/github-copilot.png\" width=\"135px\" height=\"135px\" /\u003e\u003c/a\u003e\n\u003ca href=\"https://www.credly.com/badges/aaf069f2-c02e-4313-8408-94a80aa5a818/public_url\"\u003e\u003cimg src=\"https://github.com/akashdip2001/akashdip2001/raw/main/img/Badge/lfs101-introduction-to-linux.png\" width=\"150px\" height=\"150px\" style=\"margin-bottom: 17px;\" /\u003e\u003c/a\u003e\n\u003ca href=\"https://www.credly.com/badges/ebde455d-6170-44bf-bfaf-bf9a9544213c\"\u003e\u003cimg src=\"https://github.com/akashdip2001/akashdip2001/raw/main/img/Badge/Google%20Cloud%20Computing%20Foundations%20Certificate.png\" width=\"160px\" height=\"160px\" /\u003e\u003c/a\u003e\n\n\u003ca href=\"https://www.credly.com/users/akashdip2001\"\u003e\u003cimg src=\"https://github.com/akashdip2001/akashdip2001/raw/main/img/Badge/akamai-cloud-computing-foundations-certification.png\" width=\"160px\" height=\"160px\" /\u003e\u003c/a\u003e\n\u003ca href=\"https://www.linkedin.com/posts/akashdip2001_aws-devsecops-cloudpractitioner-activity-7342667659299233792-cnbE\"\u003e\u003cimg src=\"https://github.com/akashdip2001/akashdip2001/raw/main/img/Badge/AWS%20Certified%20Cloud%20Practitioner.png\" width=\"150px\" height=\"150px\" style=\"margin-bottom: 17px;\" /\u003e\u003c/a\u003e\n\n  \u003c/div\u003e\n\u003c/details\u003e\n\u003c/div\u003e\n\n\u003c/br\u003e\n\n---\n\n## **Table of Contents**\n\n\u003cimg align=\"right\" alt=\"python_logo\" width=\"550\" src=\"source/gitflow.svg\"\u003e \n\n0. [linux-basics-course](https://github.com/akashdip2001/linux-basics-course)\n1. [Install Git \u0026 VS Code](#install-git--vs-code)\n2. [Check Git Installation](#check-git-installation)\n3. [Configuring Git (Terminal)](#configuring-git-terminal)\n      - [UserName]()\n      - [Email]() \n4. [Create Repository](#create-and-push-local-repository)\n     - [Create Local Repository](#create-and-push-local-repository)\n     - [Clone \u0026 Check Status](#clone-Repository)\n       - [Git Status Indicators](#status-indicators)\n5. [Add and Commit (Local)](#add-and-commit-local)\n   - [Create file]()\n   - [git add .]()\n   - [git commit]()\n   - [Then Modified \u0026 commit]() \n6. [Push to Remote Repository on GitHub](#push-upload-to-remote-repository-on-github)\n    1. [VS-code \u0026 Web-editor ⚠️ Merge Conflicts](https://youtu.be/vArkGr5nzVU)\n    2. 🚀 [Update the Git Remote URL]()\n8. [Initialize a New Repository](#initialize-a-new-repository)\n9. [Branch Commands](#git-branch-commands)\n    - [Check the Branch]()\n    - [Rename a Branch]()\n    - [Create a New Branch]()\n    - [Check all existing Branches]()\n    - [Navigate Between Branches]()\n    - [Delete a Branch]()\n    - 🔵 [practical Problems](#practical-Problems)\n10. [Merging Code](#git-merging-code)\n11. [GitHub Exam](./Exam/1%20github%20foundations%20certification/readme.md)\n\n---\n\n## Install Git \u0026 VS Code\n\n### Just copy \u0026 paste the code into your PowerShell - Done ✔️\n\nYou can install Git Bash using Chocolatey, a package manager for Windows. If you haven't installed Chocolatey yet, run the following command in PowerShell with administrative privileges:\n\n```powershell\nSet-ExecutionPolicy Bypass -Scope Process -Force; `\n[System.Net.ServicePointManager]::SecurityProtocol = `\n[System.Net.ServicePointManager]::SecurityProtocol -bor 3072; `\niex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))\n```\n\nThen, install Git and VS Code:\n\n```powershell\nchoco install git.install\nchoco install vscode\n```\n\n---\n\n## Check Git Installation\n\n\u003cimg align=\"right\" alt=\"python_logo\" width=\"400\" src=\"source/git_status.svg\"\u003e \n\n```bash\ngit --version\n```\n```bash\n#check where oyu are?\npwd\n```\n```bash\n#All files \u0026 folders\nls\n```\n```bash\n#The folder tracked by git or not ?\ngit status\n```\n\n| [docs](https://docs.chaicode.com/terminology/) |\n| --- |\n\n---\n\n## Configuring Git (Terminal)\n\n```bash\ngit config --global user.name \"Your Name\"\n```\n```bash\ngit config --global user.email \"your.email@example.com\"\n```\n```bash\ngit config --list\n```\n\n![Git Configuration](https://user-images.githubusercontent.com/73097560/115834477-dbab4500-a447-11eb-908a-139a6edaec5c.gif)\n\n# 🦖 Create an Repository Locally, Edit, and Push from GitHub \u003ca name=\"create-and-push-local-repository\"\u003e\u003c/a\u003e\n\n\u003cimg align=\"right\" alt=\"python_logo\" width=\"500\" src=\"source/gitflow.svg\"\u003e \n\n```yaml\nMain Folder\n│\n│── Folder 01\n└── Folder 02: I want to track this folder\n```\n```bash\ncd Folder 02\n```\n```bash\ngit status\n```\n```bash\ngit init\n```\n```yaml\nPy Projects\nMain Folder\n│\n│── Folder 01\n└── Folder 02\n     │\n     └── .git: ⚠️\n```\n## ⚠️ Not showing .git Folder ?\n#### Open Vs code -\u003e Settings -\u003e Exclud -\u003e Remove Git from here.\n\n\u003cdetails\u003e\t\n \u003csummary\u003e\u003cb\u003eimage Guide \u003cimg src=\"source/img_logo.png\" width=\"20\"/\u003e\u003c/b\u003e\u003c/summary\u003e\u003cbr\u003e\n\u003cdiv style='display:flex; align-items:center; gap: 10px;' align='center'\u003e\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"https://github.com/user-attachments/assets/862d7cd6-ed5a-48e0-b9a2-ddecef5db0f9\" alt=\"Image 1\" width=\"45%\" style=\"margin-right: 10px;\"/\u003e\n  \u003cimg src=\"https://github.com/user-attachments/assets/d8789b6b-d46e-40ae-aea7-90ee92b7a9ba\" alt=\"Image 2\" width=\"45%\" style=\"margin-right: 10px;\"/\u003e\n\u003c/p\u003e\n\u003c/div\u003e\n\u003c/details\u003e\n\n![Git Configuration](https://user-images.githubusercontent.com/73097560/115834477-dbab4500-a447-11eb-908a-139a6edaec5c.gif)\n\n# Or, 🦖 Clone an Existing Repository Locally, Edit, and Push from GitHub \u003ca name=\"clone-Repository\"\u003e\u003c/a\u003e\n\n---\n\n## Clone and Check Status\n\n```bash\ngit clone https://github.com/username/repository.git\n```\n\n```bash\ngit status\n```\n\n### Status Indicators\n\nHere’s a comprehensive table summarizing the states and their short indicators in Git, along with descriptions:\n\n| **State**        | **Short Indicator** | **Description**                                                                                     | **Icon**                       |\n|-------------------|---------------------|-----------------------------------------------------------------------------------------------------|--------------------------------|\n| **Untracked**    | `??`               | Files that Git doesn't track yet. They are new and need to be added `git add .` to start tracking. | *(No specific icon provided)* |\n| **Modified**     | `M`                | Files that have been changed but are not yet staged for commit.                                    | \u003cimg src=\"source/M-git.png\" width=\"30\"/\u003e |\n| **Staged**       | `A` or `M`         | Files added to the staging area. `A` for newly added, `M` for modified files staged for commit.    | \u003cimg src=\"source/A-git.png\" width=\"30\"/\u003e |\n| **Unmodified**   | *(none)*           | Files that are tracked and have not been modified; they remain in their last committed state.      | *(No specific icon provided)* |\n| **Unmerged**     | `U` (or `UU`)      | Files with conflicts during a merge; need resolution before completing the merge.                  | \u003cimg src=\"source/U-git.png\" width=\"30\"/\u003e | \n\n- `UU` for a file that is unmerged with conflicts.\n- `AA`, `DD`, etc., for specific merge conflict cases (e.g., both sides added or deleted a file).\n\n\u003cimg src=\"https://github.com/akashdip2001/college-final-year-project/raw/main/img/colour_line.png\"\u003e\n\n## Add and Commit (Local)\n\u003cimg align=\"right\" alt=\"python_logo\" width=\"200\" src=\"source/U-A-git.png\"\u003e\n\n### ✈️ Create new file --\u003e add \u0026 commit\n\n```bash\ntouch \"file 01\" \"file 02\"\n```\n```yaml\nPy Projects\nMain Folder\n│\n│── Folder 01\n└── Folder 02\n     │\n     │── .git:\n     │── file 01\n     └── file 02\n```\n```bash\n# git add filename_01.txt filename_02.txt\ngit add .\n```\n\u003cdetails\u003e\t\n \u003csummary\u003e\u003cb\u003eNew file add . \u003cimg src=\"source/img_logo.png\" width=\"20\"/\u003e\u003c/b\u003e\u003c/summary\u003e\n     \u003cimg src=\"https://github.com/user-attachments/assets/cbd1509f-39e9-4d95-a78b-910b1cc84229\"\u003e\n\u003c/details\u003e\n\n\u003cdetails\u003e\t\n \u003csummary\u003e\u003cb\u003eAgain create a New file \u003cimg src=\"source/img_logo.png\" width=\"20\"/\u003e \u0026 commit all\u003c/b\u003e\u003c/summary\u003e\n     \u003cimg src=\"https://github.com/user-attachments/assets/d448aaf0-2d6c-4b0d-b50f-91442960867f\"\u003e\n     \u003cimg src=\"https://github.com/user-attachments/assets/b1508042-428f-4c3e-9ddd-eb73a5fa338c\"\u003e\n\u003c/details\u003e\n\n*Use `git add .` to add all changes.*\n\n```bash\ngit commit -m \"1st commit\"\n```\n---\n\n### ✈️ Modified (edit) any file --\u003e **again** add \u0026 Commit again\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"https://github.com/user-attachments/assets/bb9ee592-da16-40d4-bf70-086d140511a5\" alt=\"Image 1\" width=\"65%\" style=\"margin-right: 10px;\"/\u003e\n  \u003cimg src=\"source/M-git.png\" alt=\"Image 2\" width=\"15%\" style=\"margin-right: 10px;\"/\u003e\n\u003c/p\u003e\n\n\u003cdetails\u003e\t\n \u003csummary\u003e\u003cb\u003eNext img \u003cimg src=\"source/M-git.png\" width=\"20\"/\u003e\u003c/b\u003e\u003c/summary\u003e\n     \u003cimg src=\"https://github.com/user-attachments/assets/e69da041-4cce-4e1c-8261-c28697f6ee60\"\u003e\n     \u003cimg src=\"https://github.com/user-attachments/assets/0e6288cf-d378-49f6-8ddd-7076e0a33b14\"\u003e\n     \u003cimg src=\"https://github.com/user-attachments/assets/3c5cace7-03df-499b-9297-acd714a3b168\"\u003e\n\u003c/details\u003e\n\n*Again Use `git add .` to add all changes.*\n```bash\ngit add filename_02.txt\n```\n\n```bash\ngit commit -m \"2nd commet after modified a file\"\n```\n\u003cp align=\"center\"\u003e\n     \u003cimg width=\"65%\" src=\"source/commit.svg\"/\u003e\n\u003c/p\u003e\n\n\u003cimg src=\"https://github.com/akashdip2001/college-final-year-project/raw/main/img/colour_line.png\"\u003e\n\n## Push (Upload to Remote Repository on GitHub)\n\n[\u003cimg align=\"right\" alt=\"python_logo\" width=\"400\" src=\"https://github.com/user-attachments/assets/81cc2f67-cf4b-45c9-94d0-e030cf179ec6\"\u003e](https://www.youtube.com/watch?v=BXR_HoROl3E)\n\n\u003cdetails\u003e\t\n \u003csummary\u003e\u003cb\u003e⚠️⚠️⚠️ VS-code \u0026 Web-editor ❌ Merge Conflicts ⚠️⚠️⚠️ \u003cimg src=\"source/img_logo.png\" width=\"20\"/\u003e\u003c/b\u003e\u003c/summary\u003e\u003cbr\u003e\n\u003cdiv style='display:flex; align-items:center; gap: 10px;'\u003e\n\n[![git \u0026 github with vs code setup](https://github.com/user-attachments/assets/a760cf72-1732-4ec3-b01f-f45112001928)](https://www.youtube.com/watch?v=mryez-QqMj4)\n\n### ⚠️ I have a github propository in the github. And I clone this repository using http URL, so I directly push my all changes through VS code. But what happened eat I open Github web editor and modify any file and push from it. This time how to sync my geethab with vs code in this two cases - case1 - if my I not work on vs good and there was no modified or changes. And in case2 - what happened I update from GitHub web editor but there was also some modification exist in v.s code which is comet but not push ⚠️\n\n### ✅ Solution ✅\n\nTo synchronize your local repository (in VS Code) with the remote GitHub repository in both cases, follow these steps:\n\n---\n\n### ✅ **Case 1: No Local Changes in VS Code**\nYou updated a file in the GitHub web editor, but no changes were made in your local repository.\n\n1. **Pull the Latest Changes**:\n   - Open the terminal in VS Code or use the Source Control tab.\n   - Run:\n     ```bash\n     git pull origin \u003cbranch_name\u003e\n     ```\n   - Replace `\u003cbranch_name\u003e` with the branch you are working on (e.g., `main` or `master`).\n\n2. **Confirm Sync**:\n   - After pulling, your local repository will now match the remote repository since there were no local changes to cause a conflict.\n\n---\n\n### ✅ **Case 2: Local Changes in VS Code Not Pushed Yet**\nYou updated a file in the GitHub web editor and also made changes locally that are committed but not pushed.\n\n1. **Pull the Latest Changes**:\n   - First, fetch and merge the remote changes using:\n     ```bash\n     git pull origin \u003cbranch_name\u003e\n     ```\n\n2. ⚠️ **Resolve Merge Conflicts (if any)**:\n   - If there are conflicts between the changes made locally and those from the GitHub web editor, Git will indicate the files with conflicts. Resolve these conflicts by:\n     - Opening the conflicted files in VS Code.\n     - Looking for conflict markers (`\u003c\u003c\u003c\u003c\u003c\u003c\u003c`, `=======`, `\u003e\u003e\u003e\u003e\u003e\u003e\u003e`).\n     - Deciding whether to keep your changes, the remote changes, or both.\n   - After resolving the conflicts, stage the resolved files:\n     ```bash\n     git add \u003cfile_name\u003e\n     ```\n   - Commit the resolved changes:\n     ```bash\n     git commit -m \"Resolved merge conflicts\"\n     ```\n\n3. **Push Your Changes**:\n   - Once the merge is complete and there are no conflicts, push your changes back to the remote repository:\n     ```bash\n     git push origin \u003cbranch_name\u003e\n     ```\n\n---\n\n### **Notes**\n- Always pull the latest changes before starting work in VS Code to minimize conflicts.\n- Use `git status` frequently to check the state of your repository and understand whether changes are staged, unstaged, or committed.\n- If you only want to review the changes made in the GitHub web editor before pulling, use:\n  ```bash\n  git fetch origin \u003cbranch_name\u003e\n  git log origin/\u003cbranch_name\u003e\n  ```\n[![git \u0026 github with vs code setup](https://github.com/user-attachments/assets/7c27723a-a05c-4c29-ba4a-18d81c225eb2)](https://www.youtube.com/watch?v=vArkGr5nzVU)\n\n\n#### ✅ This approach keeps both your local and remote repositories in sync efficiently. ✅\n\n\u003c/div\u003e\n\u003c/details\u003e\n\n### Push Changes to a Remote Repository\n\nOnce you've committed your changes locally, use the `git push` command to push those changes to a remote repository.\n\n**Syntax:**\n\n```bash\ngit push \u003cremote_name\u003e \u003cbranch_name\u003e\n```\n\n**Example:**\n\n```bash\ngit push origin main\n```\n\n*Replace `origin` with the name of your remote repository, and `main` with the name of the branch you're pushing to.*\n\nIf it's your first time pushing to the remote repository, you may need to set up tracking:\n\n```bash\ngit push -u origin main\n```\n\n*After the initial setup, simply use `git push` for future pushes.*\n\n```bash\ngit push\n```\n\n🚥🚥🚥🚥🚥🚥🚥🚥🚥🚥🚥🚥🚥🚥🚥\n\n## Update the Git Remote URL\n\n🚥🚥🚥🚥🚥🚥🚥🚥🚥🚥🚥🚥🚥🚥🚥\n### 1. 🚀 git clone from a another profile/repo\n   ![Screenshot (708)](https://github.com/user-attachments/assets/fb5aa6d3-25e5-4afd-a9f0-376ca1cf6f6e)\n\n### 2. 🚀 Check the Targate repo\n   ![Screenshot (709)](https://github.com/user-attachments/assets/5a017d80-ea69-4291-ada5-8f5de91c04fa)\n\n### 3. 🚀 Update the Targate repo\n\n####  Step 1: Update the Git Remote URL\nIn the `node-todo-cicd` directory, update the remote URL to point to your repository:\n\n```bash\ngit remote set-url origin https://github.com/akashdip2001/AWS.git\n```\n\nVerify the change with:\n\n```bash\ngit remote -v\n```\n\nIt should now display:\n\n```plaintext\norigin  https://github.com/akashdip2001/AWS.git (fetch)\norigin  https://github.com/akashdip2001/AWS.git (push)\n```\n\n---\n\n### Step 2: Move the Files to the Target Directory\n1. Create the directory structure in your repository:\n\n   ```bash\n   mkdir -p Projects/CI-CD/Project\\ 001\n   mv * Projects/CI-CD/Project\\ 001/\n   ```\n\n2. Ensure no unnecessary files (e.g., `.git` from the original project) are moved:\n\n   ```bash\n   rm -rf Projects/CI-CD/Project\\ 001/.git\n   ```\n\n---\n\n### Step 3: Stage and Commit the Changes\n1. Add the new directory and its content to the staging area:\n\n   ```bash\n   git add Projects/CI-CD/Project\\ 001/\n   ```\n\n2. Commit the changes with an appropriate message:\n\n   ```bash\n   git commit -m \"Added node-todo-cicd project to Projects/CI-CD/Project 001\"\n   ```\n\n---\n\n### Step 4: Push the Changes\nPush the changes to your repository on GitHub:\n\n```bash\ngit push origin master\n```\n\nReplace `master` with the branch name you're using if it differs.\n\n---\n\n### Step 5: Verify the Upload\n1. Go to your repository on GitHub: [https://github.com/akashdip2001/AWS](https://github.com/akashdip2001/AWS).\n2. Navigate to `Projects/CI-CD/Project 001` to ensure the files are correctly placed.\n\n---\n\nThis method ensures the project is correctly uploaded to the desired directory in your repository.\n\n![Screenshot 2024-12-20 172351](https://github.com/user-attachments/assets/af095196-abe7-4d31-9b62-db7c7a3a37bd)\n\n🚥🚥🚥🚥🚥🚥🚥🚥🚥🚥🚥🚥🚥🚥🚥\n---\n---\n\n## Initialize a New Repository\n\n**`init`** - Used to create a new repository\n\n```bash\nmkdir \u003cNewFolderName\u003e\ncd \u003cNewFolderName\u003e\ngit init\n```\n\n*Use `cd ..` to navigate back to the main folder.*\n\n*`mkdir` creates a new folder and `cd` enters it. Then, create or edit files within the folder.*\n\n```bash\ngit status\ngit add .\ngit commit -m \"Initial commit\"\ngit status\n```\n\n```bash\ngit push origin main\n```\n\n![Git Initialization](https://user-images.githubusercontent.com/73097560/115834477-dbab4500-a447-11eb-908a-139a6edaec5c.gif)\n\n# 🦖 Creating a Repository on GitHub (Without README) \u0026 Uploading Local Files\n\n**Without a README**: This allows you to clone the repository locally, initialize Git, and push all local files.\n\n\u003cimg src='source/new repo.png'\u003e\n\n```bash\ngit remote add origin https://github.com/username/repository.git\ngit remote -v\n```\n\n*Use `git remote -v` to verify the remote connection.*\n\n## Check the Branch\n\n```bash\ngit branch\n```\n\n*If you're on the `master` branch, rename it to `main`.*\n\n### Rename the Branch to `main`\n\n```bash\ngit branch -M main\ngit push -u origin main\n```\n\n*The `-u` flag sets up tracking for future pushes, allowing you to use `git push` without specifying the remote and branch.*\n\n## Push Any Changes Locally\n\n```bash\ngit status\ngit add .\ngit commit -m \"Add new file or update\"\ngit push\n```\n\n\u003cimg src=\"https://github.com/akashdip2001/college-final-year-project/raw/main/img/colour_line.png\"\u003e\n\n# 🦖 Branch Commands \u003ca name=\"git-branch-commands\"\u003e\u003c/a\u003e\n\n\u003cp align=\"center\"\u003e\n     \u003cimg width=\"65%\" src=\"source/git-branches-merge.png\"\u003e\n\u003c/p\u003e\n\n### ✈️ Check the Branch\n\n```bash\ngit branch\n```\n\n### ✈️ Rename a Branch\n\n```bash\n#git branch -M main\ngit branch -m \u003cold-branch-name\u003e \u003cnew-branch-name\u003e\n```\n\n### ✈️ Create a New Branch\n\n```bash\ngit branch \u003cnew-branch-name\u003e\n```\n```bash\ngit checkout -b \u003cnew-branch-name\u003e\n```\n\n### ✈️ Check all existing Branches\n```bash\ngit branch\n```\n\u003cdetails\u003e\t\n \u003csummary\u003e\u003cb\u003ealso check using HEAD file\u003c/b\u003e\u003c/summary\u003e\n     \u003cimg src=\"https://github.com/user-attachments/assets/16516caf-227a-4114-bf85-fb3a13081c7d\"\u003e\n     \u003cimg src=\"https://github.com/user-attachments/assets/a96e9fb9-fd58-42a8-8a3b-689f96b78810\"\u003e\n\u003c/details\u003e\n\n### ✈️ Navigate Between Branches\n```bash\n# create new Branch Then switch\ngit branch \u003cbranch-name\u003e\n```\n```bash\ngit switch \u003cbranch-name\u003e\n```\n```bash\ngit checkout \u003cbranch-name\u003e\n```\n```bash\n# Auto create the branct (if not exist) \u0026 switch\ngit switch -c \u003cbranch-name\u003e\n```\n\n### ✈️ Delete a Branch\n\n```bash\ngit branch -d \u003cbranch-name\u003e\n```\n\n### ✅ After Making Changes\n\n```bash\ngit status\ngit add .\ngit commit -m \"Your commit message\"\ngit push origin \u003cbranch-name\u003e\n```\n|  [docs](https://docs.chaicode.com/branches-in-git/) |\n| --- |\n\n## Create a new Branch in VS-Code ⚠️ git push\n\n\u003cdetails\u003e\t\n \u003csummary\u003e\u003cb\u003esteps \u003cimg src=\"https://github.com/user-attachments/assets/d236ff4c-7593-498b-aa16-5e1fec677eb5\" width=\"20\"/\u003e\u003c/b\u003e\u003c/summary\u003e\n      \n![Screenshot (359)](https://github.com/user-attachments/assets/e1d6f25d-6485-4044-b3c3-586d65a1fb95)\n\n```bash\ngit branch\n```\n```bash\ngit branch \"Test-Share-link\"\n```\n```bash\ngit switch \"Test-Share-link\"\n```\n```bash\ngit branch\n```\n```bash\ngit status\n```\n```bash\ngit add .\ngit commit -m \"add Test-Share-link .md file\"\n# ❌ git push\n```\n```bash\n# ✅\ngit push --set-upstream origin Test-Share-link\n```\n![Screenshot (360)](https://github.com/user-attachments/assets/07bde987-8385-4313-9b14-033510b007c6)\n![Screenshot (361)](https://github.com/user-attachments/assets/883e57e7-16df-4fae-babf-70b8a0d23eab)\n![Screenshot (362)](https://github.com/user-attachments/assets/c9e4e990-6403-4e1c-9325-8a9e0b2bea1e)\n![Screenshot (363)](https://github.com/user-attachments/assets/596f4a09-f6cf-4dd6-b641-ad631494d859)\n\n\u003c/details\u003e\n\n![Branch Operations](https://user-images.githubusercontent.com/73097560/115834477-dbab4500-a447-11eb-908a-139a6edaec5c.gif)\n\n---\n\n# Some practical-Problems \u003ca name=\"practical-Problems\"\u003e\u003c/a\u003e\n## create a Project Locallyt with branch name `master` and 🔵 want to upload a existing Repo with `main' branch.\n### 🟢 Normally you can push your code with `master` and Marge the Branch in GitHub ⚙️⚙️⚙️⚙️⚙️⚙️⚙️⚙️⚙️⚙️⚙️⚙️⚙️⚙️⚙️⚙️⚙️⚙️⚙️⚙️⚙️\n\u003e *“The workspace currently open doesn’t have any folders containing Git repositories.”*\n\nYou want to upload this directory to your **existing GitHub repo**:  \n👉 [`https://github.com/akashdip2001/Arduino-IDE-setup`](https://github.com/akashdip2001/Arduino-IDE-setup)\n\n---\n\n### ✅ Steps to Upload Your Current Directory to That Repo:\n\nFollow these simple steps inside VS Code terminal:\n\n---\n\n#### 🟢 1. Initialize Git in Your Project Folder\n\nIf you haven’t yet:\n```bash\ncd path/to/ESP8266_LED_Control\ngit init\n```\n\n---\n\n#### 🟢 2. Add Remote Link to Your Existing GitHub Repo\n\n```bash\ngit remote add origin https://github.com/akashdip2001/Arduino-IDE-setup.git\n```\n\n\u003e If you get an error like *“remote origin already exists”*, use:\n```bash\ngit remote set-url origin https://github.com/akashdip2001/Arduino-IDE-setup.git\n```\n\n---\n\n#### 🟢 3. Add and Commit All Files\n\n```bash\ngit add .\ngit commit -m \"Upload ESP8266 LED Control project\"\n```\n\n---\n\n#### 🟢 4. Push to GitHub\n\n\u003e If your GitHub repo's branch is `main`:\n\n```bash\ngit push -u origin main\n```\n\n\u003e Or if it's `master`:\n\n```bash\ngit push -u origin master\n```\n\n---\n\n#### ✅ Done! Check your repo\n\nGo to your repo page: [github.com/akashdip2001/Arduino-IDE-setup](https://github.com/akashdip2001/Arduino-IDE-setup) — your files should now be uploaded 🎉\n\n---\n\n## 🔵⚠️ Some Tile error comes when try to upload in `main` branch\nyou **can directly upload to the `main` branch**, but here’s what’s happening and how to fix it in the cleanest way:\n\n---\n\n### 🔍 What Happened ??\n\n- Your **local branch** is named `master` by default.\n- Your **GitHub repo (`https://github.com/akashdip2001/Arduino-IDE-setup.git`)** has the **`main` branch** (not `master`).\n- When you tried `git push origin main`, Git said:  \n  `error: src refspec main does not match any`  \n  ➤ Because your local branch is still named `master`.\n\n---\n\n### ✅ Two Easy Fix Options\n\n#### 🔵 **Option 1: Rename Local `master` to `main`** (RECOMMENDED)\n\nThis way, you’ll align with GitHub’s default and won’t create extra branches.\n\n```bash\ngit branch -m master main\ngit push -u origin main\n```\n\nDone! Now you’re working with the `main` branch directly, just like your GitHub repo. ✔️\n\n---\n\n#### 🔵 **Option 2: Push `master` as `main`**\n\nIf you don't want to rename the local branch but still push it to `main` on GitHub:\n\n```bash\ngit push -u origin master:main\n```\n\nThis tells Git: “Push my local `master` branch **to the remote `main` branch**.”\n\n---\n\n### 🧹 Clean Tip\n\nTo always start your new projects with a `main` branch locally, you can set this globally:\n\n```bash\ngit config --global init.defaultBranch main\n```\n\nThis avoids the `master` vs `main` mix-up in the future. ✅\n\n---\n\n## ⚠️ error come for **Option 1**\nThis is just a small sync issue between your **local `main`** branch and the **remote `main`** branch on GitHub.\n\n---\n\n### 💥 What's the problem ??\n\nThe remote `main` branch **already has some commits** (probably a README or `.gitignore` added through GitHub's UI), but your local `main` doesn't have them. So Git is blocking your push to avoid overwriting remote history.\n\n---\n\n### ✅ How to fix it safely\n\nHere’s the step-by-step:\n\n---\n\n### 🔵\n1. **Pull remote `main` first** and merge\n\n```bash\ngit pull origin main --allow-unrelated-histories\n```\n\n- The `--allow-unrelated-histories` flag helps when your local repo and the GitHub repo were initialized separately.\n- You may be asked to enter a merge commit message. Just accept it (save and close the editor).\n\n---\n\n### 2. **Now push successfully**\n\n```bash\ngit push -u origin main\n```\n\nBoom 💥! Now your local project is successfully pushed to GitHub’s `main` branch.\n\n![Screenshot (292)](https://github.com/user-attachments/assets/185d6f24-9799-4b82-9070-2dfddd3c5630)\n\n---\n\n### ✅ Optional Cleanup (Next time)\n\nTo avoid this in future projects:\n\n- **Create the repo on GitHub *without* any files** (uncheck README, .gitignore, License).\n- Or **initialize your local repo first**, then push, and GitHub won’t have conflicts.\n\n---\n\n⚙️⚙️⚙️⚙️⚙️⚙️⚙️⚙️⚙️⚙️⚙️⚙️⚙️⚙️⚙️⚙️⚙️⚙️⚙️⚙️⚙️\n\n# 🦖 Merging Code \u003ca name=\"git-merging-code\"\u003e\u003c/a\u003e\n\n## Method 1: Using Git Commands\n\n\u003cimg align=\"right\" alt=\"python_logo\" width=\"400\" src=\"source/fast-merge.svg\"\u003e \n\n```bash\n#git diff \u003cbranch-name\u003e   # Compare commits, branches, files \u0026 more\ngit merge \u003cbranch-name\u003e\n```\n\n\u003cdetails\u003e\t\n \u003csummary\u003e\u003cb\u003eGUI\u003c/b\u003e\u003c/summary\u003e\n     \u003cimg src=\"https://github.com/user-attachments/assets/5cb91386-b9de-4c8b-8852-cce8fae46f5b\"\u003e\n\u003c/details\u003e\n\n## Method 2: Creating a Pull Request (PR)\n\n```bash\ngit pull origin main    # Download and synchronize with GitHub\n```\n\n![Merge Operations](https://user-images.githubusercontent.com/73097560/115834477-dbab4500-a447-11eb-908a-139a6edaec5c.gif)\n\n---\n\n| 📄 [Documentation](https://docs.chaicode.com/git-and-github/) | \u003cimg src=\"https://user-images.githubusercontent.com/81384987/209952974-0163b04e-ccae-4be5-844a-075ef85c43d2.png\" height=\"15\" width=\"20\"/\u003e  [My YouTube Channel](https://youtu.be/q8EevlEpQ2A?si=AFDUT-cTa-OXjufz\u0026t=6370) |\n| --- | --- |\n\n---\n\n# [GitHub Exam](./Exam/1%20github%20foundations%20certification/readme.md)\n\n[![github exam](https://github.com/user-attachments/assets/61d30632-d31c-4365-b015-38126371dbef)](https://github.com/akashdip2001/git-github/tree/main/Exam)\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fakashdip2001%2Fgit-github","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fakashdip2001%2Fgit-github","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fakashdip2001%2Fgit-github/lists"}