{"id":22003535,"url":"https://github.com/riju18/git-commands","last_synced_at":"2026-04-29T11:02:53.154Z","repository":{"id":151804082,"uuid":"392977486","full_name":"riju18/Git-Commands","owner":"riju18","description":"Essential \u0026 regular use of git commands","archived":false,"fork":false,"pushed_at":"2024-07-06T06:21:54.000Z","size":9,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-23T06:16:36.221Z","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/riju18.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":"2021-08-05T09:10:36.000Z","updated_at":"2024-07-06T06:21:58.000Z","dependencies_parsed_at":"2023-08-01T04:46:39.152Z","dependency_job_id":null,"html_url":"https://github.com/riju18/Git-Commands","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/riju18/Git-Commands","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/riju18%2FGit-Commands","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/riju18%2FGit-Commands/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/riju18%2FGit-Commands/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/riju18%2FGit-Commands/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/riju18","download_url":"https://codeload.github.com/riju18/Git-Commands/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/riju18%2FGit-Commands/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32422533,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-29T06:29:02.080Z","status":"ssl_error","status_checked_at":"2026-04-29T06:29:00.631Z","response_time":110,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: 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"],"created_at":"2024-11-30T00:09:58.390Z","updated_at":"2026-04-29T11:02:53.138Z","avatar_url":"https://github.com/riju18.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# Most frequently used Git Commands\n\n# index\n\n+ [Configuration](#configuration)\n+ [Regular-cmd](#regular-cmd)\n+ [Advanced-cmd](#advanced-cmd)\n+ [Branch](#branch)\n+ [History](#history)\n+ [Undo](#undo)\n+ [Clean](#clean)\n+ [Tag](#tag)\n+ [Seperate Branch and Merge](#seperate-branch)\n\n# configuration\n\n+ **Username \u0026 Email**\n\n  ```\n  git config --global user.name \"userName\"\n  git config --global user.email \"emailAddress\"\n  ```\n\n# Regular-cmd\n\n+ **init git**\n\n  ```\n  git init\n  ```\n\n+ **status**\n\n  ```\n   git status\n  ```\n\n+ **differeneces between previous \u0026 new code**\n\n  ```\n  git diff \n  or, \n  git diff hashNo1 \n  or, \n  git diff hashNo1 hashNo2\n  ```\n\n+ **add in git**\n\n  ```\n  git add . or git add file-name or git add -A dir-name/\n  ```\n\n+ **delete file/dir**\n\n    ```\n    git rm fileName\n    git rm -rf dirName\\\n    ```\n\n+ **rename file/dir**\n\n    ```\n    git mv oldFileName NewFileName\n    ```\n\n+ **commit**\n\n  ```\n   git commit -m \"msg\"\n  ```\n\n+ **link to repo**\n\n  ```\n   git remote add origin repo-link\n  ```\n\n+ **push to repo**\n\n  ```\n  git push -u origin branchName\n  ```\n\n+ **sync changed code**\n\n  ```\n  git pull origin branchName\n  ```\n\n# advanced-cmd\n\n+ **stash** : save uncommitted changes as draft.\n  \n  + init stash\n\n    ```\n    git stash\n    ```\n  \n  + save stash with msg\n\n    ```\n    git stash save \"msg\"\n    ```\n  \n  + show stash\n\n    ```\n    git stash show stash@{n}\n    ```\n  \n  + stash branch\n\n    ```\n    git stash branch branchName\n    ```\n  \n  + stash untracked file\n\n    ```\n    git stash -u\n    ```\n  \n  + stash all file\n\n    ```\n    git stash -a\n    ```\n  \n  + list of stash\n\n    ```\n    git stash list\n    ```\n  \n  + aply stash\n\n    ```\n    git stash apply\n    ```\n  \n  + push to master\n\n    ```\n    git push -u origin master\n    ```\n  \n  + remove stash\n\n    ```\n    git stash drop\n    git stash pop\n    ```\n  \n  + remove last stash\n\n    ```\n    git stash pop\n    ```\n\n# branch\n\n+ **New Branch**\n\n  + **all branch**\n\n    ```\n     git branch\n    ```\n  \n  + **all unmerged branch**\n\n    ```\n    git branch -a\n    ```\n\n  + **create new branch**\n\n    ```\n     git branch branch_name\n    ```\n\n  + **activate branch**\n\n    ```\n     git checkout branch_name\n    ```\n  \n  + **compare branch**\n  \n    ```\n      git diff branch1 branch2\n    ```\n\n  + **goto master branch**\n\n    ```\n    git checkout master\n    ```\n\n  + **merge with master**\n\n    ```\n    git merge branch-name\n    ```\n\n  + **check all branches merged with master**\n\n    ```\n    git branch --merged\n    ```\n\n  + **push to repo**\n\n    ```\n    git push -u origin master\n    ```\n\n+ **rename branch**\n\n  ```\n    git branch -m old_branch_name new_branch_name\n  ```\n\n+ **delete Branch** :\n\n  ```\n  git branch -d branch-name ( It'll delete locally )\n  git push origin --delete branch-name\n\n# history\n\n+ **all previous commits of the branch**\n\n  ```\n   git log\n   git log branchName\n   git log fileName\n   git log --oneline\n   git log --oneline --graph --decorate\n  ```\n\n+ **history in timeframe**\n\n  ```\n  git log --since=\"2 months ago\"\n  ```\n\n+ **full history of particular cmd**\n\n  ```\n  git show commitHashCode\n  ```\n\n+ **all previous commit with statistics**\n\n  ```\n  git log --stat\n  ```\n\n+ **get which cmd has been made since beginning**\n\n  ```\n  git reflog\n  ```\n\n# undo\n\n+ Basic Undo :\n  + **undo the new changes ( It'll remove all the new changes in the particular file)**\n\n    ```\n    git checkout filename\n    ```\n\n  + **change the recent commit message**\n\n    ```\n    git commit --amend -m \"msg\"\n    ```\n\n+ **delete Commit from master \u0026 add that commit in particular branch**\n  + 1st : copy the particular hash(6-7 chars or full)\n  + 2nd : goto desired branch\n\n  ```\n  git cherry-pick coppied-hash\n  ```\n\n  + 4th : goto master branch\n\n  ```\n  git reset --soft master-initial-commit-hash\n  ```\n\n+ **undo after added**\n\n  ```\n  git reset fileName\n  ```\n\n# clean\n\n+ **remove all untracked file \u0026 dir**\n\n  ```\n  git clean -df\n  ```\n\n# tag\n\n\u003e Tag is always created after committing. Ex : release version.\n\n+ create tag\n\n  ```\n  git tag -a tagName\n  ```\n\n+ tag list\n\n  ```\n  git tag --list\n  ```\n\n+ show tag\n\n  ```\n  git show tagName\n  ```\n\n+ difference between tag\n\n  ```\n  git diff tagName1 tagName2\n  ```\n\n+ tag a particular commit\n\n  ```\n  git tag -a tagName commitCode\n  ```\n\n+ update tag particular commitCode\n\n  ```\n  git tag -a tagName -f commitCode\n  ```\n\n+ delete tag\n\n  ```\n  git tag --delete tagName\n  ```\n\n# seperate-branch\n\n+ create seperate branch\n  ```sh\n  git checkout --orphan new-branch\n  git rm -rf .\n  ```\n\n+ merge\n  ```sh\n  git checkout dev\n  git merge orphan_branch_name --allow-unrelated-histories --no-ff -m \"Merge orphan branch into dev\"\n  ```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Friju18%2Fgit-commands","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Friju18%2Fgit-commands","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Friju18%2Fgit-commands/lists"}