{"id":18418128,"url":"https://github.com/ishaansathaye/git-commands","last_synced_at":"2026-04-26T22:31:37.727Z","repository":{"id":141544840,"uuid":"413687229","full_name":"ishaansathaye/Git-Commands","owner":"ishaansathaye","description":"GIt Commands Reference","archived":false,"fork":false,"pushed_at":"2023-01-09T04:57:00.000Z","size":7,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-13T08:55:55.493Z","etag":null,"topics":["git","github","notes","reference"],"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/ishaansathaye.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-10-05T05:35:01.000Z","updated_at":"2022-03-12T06:25:40.000Z","dependencies_parsed_at":null,"dependency_job_id":"162d888a-6737-4007-b4ac-b31964c73d74","html_url":"https://github.com/ishaansathaye/Git-Commands","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ishaansathaye/Git-Commands","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ishaansathaye%2FGit-Commands","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ishaansathaye%2FGit-Commands/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ishaansathaye%2FGit-Commands/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ishaansathaye%2FGit-Commands/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ishaansathaye","download_url":"https://codeload.github.com/ishaansathaye/Git-Commands/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ishaansathaye%2FGit-Commands/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32315711,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-26T21:09:39.134Z","status":"ssl_error","status_checked_at":"2026-04-26T21:09:21.240Z","response_time":129,"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","notes","reference"],"created_at":"2024-11-06T04:12:38.226Z","updated_at":"2026-04-26T22:31:37.712Z","avatar_url":"https://github.com/ishaansathaye.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# Git and Git Commands\n\n## Commands to Create Repo in Remote and Local from scratch\n\n### Going back one directory\n\n```zsh\ncd ..\n```\n\n### Back to User Directory\n\n```zsh\n~\n```\n\n### Creating a Local repository\n\n```zsh\ncd Github\ngit init ExampleName\n#Or create directory and then initalize git\nmkdir ExampleName\ngit init\n#add file or change code\n```\n\n### Create a new public GitHub Repository\n\n```zsh\n#Or create repo with or without readme on Github\ncurl -u ishaansathaye https://api.github.com/user/repos -d '{\"name\":\"NEW_REPO_NAME\",\"private\":false}'\n#Enter token\n```\n\n### Add remote connection to local\n\n```zsh\ngit add .\ngit commit -m \"first commit\"\ngit branch -M main\ngit remote add origin #clone link\n```\n\n### Pushing to cloud onto Github (upstream)\n\n```zsh\ngit push -u origin main\ngit push #after above command\ngit push --set-upstream origin master #consider using ssh instead of https\n```\n\n### Creating Files (Readme file)\n\n```zsh\ntouch README.md\n```\n\n### Status of Repo and **Differences in Code**\n\n```zsh\ngit status\ngit diff #differences in code\n```\n\n### Staging and Committing\n\n```zsh\ngit add . #stages all files or git add -A\ngit add \"filename\"\ngit status\ngit commit -m \"message\"\n\ngit reset FILE_NAME #remove files from staging area (git reset alone applies to all files)\n```\n\n---\n\n## Branching\n\n### Creating a Branch\n\n```zsh\ngit branch #shows all the branches\ngit branch \u003cBRANCH_NAME\u003e #creates branch\ngit checkout \u003cBRANCH_NAME\u003e #switches to branch\n```\n\n## Pushing Branch to Remote\n\n```zsh\ngit push -u origin \u003cBRANCH_NAME\u003e #associate remote and local branches (after, use git push and pull)\ngit branch -a #see all branches\n```\n\n## Merging a Branch\n\n```zsh\ngit checkout master\ngit pull origin master #always pull down from master\ngit branch --merged #what branches have been merged so far\ngiet merge \u003cBRANCH_NAME\u003e\ngit push origin master\n```\n\n## Deleting a Branch\n\n```zsh\ngit branch --merged #just check if everything successfully merged\ngit branch -d \u003cBRANCH_NAME\u003e #deletes branch\ngit branch -a #still have branch on remote\ngit push origin --delete \u003cBRANCH_NAME\u003e #deletes remote branch\n```\n\n---\n\n## Useful Commands\n\n### Cloning a Remote Repo\n\n```zsh\ngit clone \u003curl\u003e \u003cwhere to clone\u003e # . means current directory\n#neds to be empty directory to specify directory\n```\n\n### Timestamp, Log, Removing Git from Repo\n\n```zsh\ngit log #gives history of changes to repository\nls -la #lists all files in repo with timestamp\nrm -rf .git #removes git directory (used for removing directories)\n```\n\n### Ignore Files\n\n```zsh\ntouch .gitignore\n*.pyc #putting star before extension ignores all file names with extension\n```\n\n### Renaming Local and Remote Repository\n\n```zsh\ngit mv #renames a file or directory in a repo\ngit remote set-url origin NEW_URL #change remote name first and then retrieve url\n```\n\n### View Info on Remote Repo\n\n```zsh\ngit remote -v #information about remote branch\ngit branch -a #views all the branches\n```\n\n### Practice for Pulling and Pushing\n\n```zsh\ngit pull origin master\ngit push origin master\n```\n\n---\n\n## Contributing\n\n### Forking\n\n```zsh\n#fork from remote\ngit clone \u003curl\u003e \u003cwhere to clone\u003e\n#make a new branch for oneself if in team\n#make changes\n#push it back to your repo\n```\n\n### Submitting a Pull Request\n\n- Once changes made:\n  - Compare and Pull Request button shows up on remote\n  - click Create pull request\n\n### Reviewing and Approving a Pull Request\n\n- **Finding Pull Request**\n  - click Pull requests on repo in remote\n  - click pull request that has to be reviewed\n  - click on files changed\n- **Reviewing Pull Request**\n  - add a comment on line of code (blue plus button on side)\n  - click and drag to select block and then click blue plus button\n  - can also suggest changes to lines\n- **Starting a Review**\n  - if finished, click on start a review\n- **Options to Submit Review**\n  - select comment to leave general feedback, but no actual approval\n  - select approve to submit feedback and approve merging the changes\n  - select request changes to submit feedback before pull request is merged\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fishaansathaye%2Fgit-commands","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fishaansathaye%2Fgit-commands","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fishaansathaye%2Fgit-commands/lists"}