{"id":26159925,"url":"https://github.com/gayatripisya/git_comands","last_synced_at":"2026-07-07T09:31:37.640Z","repository":{"id":256891873,"uuid":"856811880","full_name":"GayatriPisya/Git_Comands","owner":"GayatriPisya","description":"These commands cover the most common tasks for working with GitHub repositories!","archived":false,"fork":false,"pushed_at":"2024-10-06T03:00:05.000Z","size":24,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-11T11:45:54.984Z","etag":null,"topics":["git"],"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/GayatriPisya.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-09-13T08:51:27.000Z","updated_at":"2024-10-11T12:49:26.000Z","dependencies_parsed_at":"2024-09-13T17:00:23.983Z","dependency_job_id":"b3b896dc-5c05-4d34-be6f-9ce6892b5802","html_url":"https://github.com/GayatriPisya/Git_Comands","commit_stats":null,"previous_names":["gayatripisya/git_comands"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/GayatriPisya/Git_Comands","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GayatriPisya%2FGit_Comands","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GayatriPisya%2FGit_Comands/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GayatriPisya%2FGit_Comands/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GayatriPisya%2FGit_Comands/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/GayatriPisya","download_url":"https://codeload.github.com/GayatriPisya/Git_Comands/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GayatriPisya%2FGit_Comands/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":35223382,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-07-07T02:00:07.222Z","response_time":90,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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"],"created_at":"2025-03-11T11:39:38.905Z","updated_at":"2026-07-07T09:31:37.230Z","avatar_url":"https://github.com/GayatriPisya.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# Git_Comands\n# Configure Git with your username \ngit config --global user.name \"Your Name\"\n# Configure Git with your  email\ngit config --global user.email \"youremail@example.com\"\n# Initialize a new Git repository in your directory\ngit init\n\n# Add all files to staging\ngit add .\n\n# Commit with a message\ngit commit -m \"Initial commit\"\n\n# Connect your local repository to a GitHub repo\ngit remote add origin https://github.com/username/repo-name.git\n\n# Push to GitHub (main/master branch)\ngit push -u origin main\n\n# Clone a repository from GitHub\ngit clone https://github.com/username/repo-name.git\n\n# List all branches\ngit branch\n\n# Create a new branch\ngit branch branch-name\n\n# Switch to a branch\ngit checkout branch-name\n\n# Create and switch to a new branch\ngit checkout -b new-branch\n\n# Push the new branch to GitHub\ngit push -u origin new-branch\n\n# Stage specific files\ngit add file1 file2\n\n# Stage all files\ngit add .\n\n# Commit changes\ngit commit -m \"Commit message\"\n\n# Push commits to the remote repository\ngit push\n\n# Fetch updates from the remote repository\ngit fetch\n\n# Pull updates from the remote repository and merge them into your current branch\ngit pull\n\n# Merge a branch into your current branch\ngit merge branch-name\n\n# View the status of your working directory\ngit status\n\n# View the changes made to files\ngit diff\n\n# Unstage a file but keep the changes\ngit reset file-name\n\n# Discard changes in a file\ngit checkout -- file-name\n\n# Revert a commit\ngit revert commit-hash\n\n# Delete a local branch\ngit branch -d branch-name\n\n# Delete a remote branch\ngit push origin --delete branch-name\n# In git bash or terminal \n# Check if you have an SSH key\nls -al ~/.ssh\n\n# Generate a new SSH key if needed\nssh-keygen -t rsa -b 4096 -C \"your_email@example.com\"\n\n# Add the key to the ssh-agent\neval \"$(ssh-agent -s)\"\nssh-add ~/.ssh/id_rsa\n\n# Copy your SSH public key to GitHub\ncat ~/.ssh/id_rsa.pub\n\ngit clone git@github.com:username/repo-name.git\ncd repo-name\n# Merge 3 sub branches to one main branch\n# Rename the branch\ngit branch -M student\n\n# Push to GitHub and set it as the main branch\ngit push -u origin student\n\n# Create and Switch to the student1 Branch\ngit checkout -b student1\n\n# Add Two Files in the student1 Branch\necho \"This is file1\" \u003e file1.txt\necho \"This is file2\" \u003e file2.txt\n\n# Add, commit, and push\ngit add .\ngit commit -m \"Add file1 and file2 to student1 branch\"\ngit push -u origin student1\n\n# Create the studentinfo Branch\ngit checkout student   # Switch back to the `student` branch\ngit checkout -b studentinfo\n\n# Add Two Files in the studentinfo Branch\necho \"This is info1\" \u003e info1.txt\necho \"This is info2\" \u003e info2.txt\n\n# Add, commit, and push\ngit add .\ngit commit -m \"Add info1 and info2 to studentinfo branch\"\ngit push -u origin studentinfo\n\n# Create the studentevent Branch\ngit checkout student  # Switch back to the `student` branch\ngit checkout -b studentevent\n\n# Add Two Files in the studentevent Branch\necho \"This is student_file1\" \u003e student_file1.txt\necho \"This is student_file2\" \u003e student_file2.txt\n\n# Add, commit, and push\ngit add .\ngit commit -m \"Add student_file1 and student_file2 to student branch\"\n\ngit push -u origin studentevent\n\n\ngit push -u origin student\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgayatripisya%2Fgit_comands","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgayatripisya%2Fgit_comands","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgayatripisya%2Fgit_comands/lists"}