{"id":25658868,"url":"https://github.com/jarvislin94/git-common-problems-and-solutions","last_synced_at":"2026-06-19T00:31:59.686Z","repository":{"id":163757796,"uuid":"117920256","full_name":"jarvislin94/Git-common-problems-and-solutions","owner":"jarvislin94","description":"git速查手册","archived":false,"fork":false,"pushed_at":"2019-07-03T03:12:39.000Z","size":8,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-11-15T08:29:33.556Z","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/jarvislin94.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":"2018-01-18T02:25:06.000Z","updated_at":"2020-05-26T05:16:28.000Z","dependencies_parsed_at":null,"dependency_job_id":"5c91f418-9eef-48e8-b499-816d458b889e","html_url":"https://github.com/jarvislin94/Git-common-problems-and-solutions","commit_stats":null,"previous_names":["jarvislin94/git-common-problems-and-solutions"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/jarvislin94/Git-common-problems-and-solutions","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jarvislin94%2FGit-common-problems-and-solutions","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jarvislin94%2FGit-common-problems-and-solutions/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jarvislin94%2FGit-common-problems-and-solutions/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jarvislin94%2FGit-common-problems-and-solutions/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jarvislin94","download_url":"https://codeload.github.com/jarvislin94/Git-common-problems-and-solutions/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jarvislin94%2FGit-common-problems-and-solutions/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34513020,"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-06-18T02:00:06.871Z","response_time":128,"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-02-24T00:29:18.595Z","updated_at":"2026-06-19T00:31:59.647Z","avatar_url":"https://github.com/jarvislin94.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# Git 常见问题与解决办法\n（方便自己以后遇到同样问题的时候查阅)\n\n### 1. packet_write_wait connection to xx.xx.xx.xx Broken pipe   \n### s：\n  找到git安装的目录/etc/ssh，打开ssh_config文件\n  ```\n  sudo vim /etc/ssh/ssh_config \n  ```\n  在其中修改（或者添加）\n  ```\n  Host *\n  ServerAliveInterval 120\n  ```\n### 2. 如何撤销已 commit 的代码？\n### s：\n```\n  git log //查看节点\n  git reset commit_id //回退到上一个提交的节点\n```\n### 3. git 误操作 git reset 强制回滚，恢复 commit 方法\n### s:\n```\n  git reflog //git reflog 会记录所有HEAD的历史\n  git reset --hard // 回滚reset\n```\n### 4. 如何撤销 push\n### s:\n1. 利用git reset 先在本地回退到自己想要的版本\n2. 利用 git push origin \u003cbranch\u003e --force 强制更新\n```\n  git log\n  git reset \u003ccommit\u003e\n  git push origin \u003cbranch\u003e --force\n```\n### 5. 添加远程仓库作为本仓库的上游\n### s:  \n  ```\n  git remote add \u003calias\u003e \u003cupstream git url\u003e \n  // when you set alias you can fetch the upstream code use alias,just like as flow\n  git remote add jackzong \u003cupstream git url\u003e\n  git pull jackzong \u003cbranch\u003e\n  ```\n### 6. rebase参数的使用和作用\n### s:\n  ```\n  git pull \u003calias\u003e \u003cbranch\u003e --rebase\n  作用：\n  使用merge合并\n        D--------E  \n     /          \\\nA---B---C---F----G   master, origin/master\n  使用rebase\n  A---B---C---F---D'---E'   master, origin/master\n  ```\n### 7. git过滤匹配包含指定字段的branch\n ```\n  git branch --list \"*outlook*\"\n ```\n### 8. git 删除指定的一些branch\n  ```\n  git branch -D/-d `git branch --list \"*outlook*\"` //删除全部包含outlook关键字的branch\n  ```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjarvislin94%2Fgit-common-problems-and-solutions","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjarvislin94%2Fgit-common-problems-and-solutions","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjarvislin94%2Fgit-common-problems-and-solutions/lists"}