{"id":21877503,"url":"https://github.com/erabossid/git","last_synced_at":"2025-03-10T14:23:23.405Z","repository":{"id":166676958,"uuid":"304668799","full_name":"erabosscode/git","owner":"erabosscode","description":"Git Documents","archived":false,"fork":false,"pushed_at":"2020-10-16T15:36:49.000Z","size":4,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-02-07T02:22:54.187Z","etag":null,"topics":["git","github","github-pages"],"latest_commit_sha":null,"homepage":"https://tradecoder.com/git/","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/erabosscode.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2020-10-16T15:35:59.000Z","updated_at":"2021-03-23T09:27:21.000Z","dependencies_parsed_at":"2023-06-01T15:15:34.744Z","dependency_job_id":null,"html_url":"https://github.com/erabosscode/git","commit_stats":null,"previous_names":["tradecoder/git","logixmaster/git","mydigita/git","erabossid/git","erabosstt/git","erabosscode/git"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/erabosscode%2Fgit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/erabosscode%2Fgit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/erabosscode%2Fgit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/erabosscode%2Fgit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/erabosscode","download_url":"https://codeload.github.com/erabosscode/git/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242865171,"owners_count":20197845,"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","github-pages"],"created_at":"2024-11-28T08:09:28.728Z","updated_at":"2025-03-10T14:23:23.386Z","avatar_url":"https://github.com/erabosscode.png","language":null,"readme":"# git\nGit Documents\n\n## Clone a project from the github\n\n`git clone https://github.com/githubusername/projectname.git`\n\nExample clone of the this project:\n\n`git clone https://github.com/tradecoder/git.git`\n\n## Add remote url from local machine\n`git remote add origin https://github.com/githubusername/projectname.git`\n\nExample add of this project url\n\n`git remote add origin https://github.com/tradecoder/git.git`\n\n## Remove remote url from the local machine\n`git remote remove origin`\n\nIf you want to add another remote url, at first you need to remove the current remote url then to add new url\n\n## Add any changes including files, folders and codes\n`git add --all`\n\n## Commit all changes \n`git commit -m 'your commit message here'`\n\n## Push your source code to the github\n`git push` (This will push the source codes on the current branch) \u003cbr/\u003e\n`git push origin master` (This will push the source codes to the master branch) \u003cbr/\u003e\nalso `git push -u origin master`\n\n## Check recent commit history\n`git log`\n\n## Initialize new git repository\n`git init`\n\n## Reset saved but uncommitted code \nFirst save unsaved work or close and reopen the file, then use this command\n\n`git reset --hard` \u003cbr/\u003eThen use `git pull`\n\n## Restore your currently changed files\n`git restore`\n\n## Force to push your code if you think it's ok but it is refusing\n`git push -f origin master`\n\n## Create a new branch\n`git branch your_new_branch_name`\n\n## Go / switch to a branch\n`git checkout your_target_branch_name`\u003cbr/\u003e\n`git switch your_target_branch_name`\n\n## Create a new branch and switch to that branch\n`git checkout -b your_new_branch_name`\n\n## Check the changes status\n`git status`\n\n## Create an orphan branch \nAn ophan branch is completely a new branch without any git history or git commit. You need to commit add all the files to this branch before making a commit\n\n```\ngit checkout --orphan yourNewBranchNameHere\ngit add -A\ngit commit -m 'commitMessageHere'\n```\n\n## Remove git commit history from your repo\nFirst make an orphan branch, then add all files, then commit the files to that orphan branch, then delete the master branch, then remove remote origin if exists, then git init, then add remote origin url, then push your code with force and finally remove all the old files, continue your work...\n```\ngit checkout --orphan newbranch\ngit add -A\ngit commit -m 'firstcommit'\ngit branch -D master\ngit branch -m master\ngit remote remove origin\ngit init\ngit remote add origin https://github.com/yourUsername/yourGithubRepoName.git\ngit push -f origin master\ngit gc --aggressive --prune=all\n```\n\n## Warning: Shallow update not allowed!\n## How to remove shallow clone?\n## What is shallow clone?\nShallow clone is just cloning a repository using `--depth` \u003cbr/\u003e\nIf you use Shallow clone to your local machine, it will not allow you to push your codes to your remote origin. You have to remove the shallow clone record to push your codes to remote repository. To do this just follow this :\n```\ngit fetch --unshallow https://github.com/this_is_the_source_url_from_where_you_did_clone_it.git\n```\nNow do your regular work, if you still have not set your new remote url, set it before to push\n```\ngit remote remove origin\ngit init\ngit remote add origin https://github.com/your_new_repository_url_here.git\ngit push origin master\n```\nChange the branch name if you need. Set upstream as your own\n\n## Get update codes on local machine from the github repo\n`git pull` also `git pull origin master`\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ferabossid%2Fgit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ferabossid%2Fgit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ferabossid%2Fgit/lists"}