Git 不同步的分支,想要重新推送所有提交

Git desynced branch, wants to re push all commits

我正在做一个项目,我曾经合并过,但是这个很混乱。

这是我的工作方式:

这是我的问题,正如您看到的红线,合并带来了超过 600 次提交(实际上是我所有的提交)

我尝试过合并和变基,每次它想要推送 600 个提交, 我还使用 hotfix 中的 cherry-pick 手动恢复了丢失的提交,以选择丢失的提交。

我在这个项目中工作已经有一段时间了,也许我错过了一些东西......

编辑 1:

这是我尝试合并时发生的情况

编辑 2:

这是我的git日志的一部分,最后一次成功合并develophotfix0ba9488(注意如果我合并到master同样的问题发生而不是 testing)

*   8a7116b - (58 seconds ago) Merge branch 'develop' into hotfix - Dymerz (HEAD -> hotfix)
|\
* | c4b4ab6 - (5 days ago) Bot: Remove unnecessary print() - Dymerz (origin/hotfix)
* | 1f1fd6e - (5 days ago) API: Add users `stars` fields - Dymerz
* | 2e84751 - (3 weeks ago) Remove .gitattributes - Dymerz
* | 1438350 - (10 weeks ago) Bot: Fix !info and !privilege command - Dymerz
* | e920f47 - (10 weeks ago) Bot: Update Python version - Dymerz
* | d72c721 - (6 days ago) docker-compose: Add database healthcheck - Dymerz (origin/master, master)
* | de5219a - (6 days ago) DB: Fix bad configuration permission - Dymerz
| | *   789305a - (5 days ago) Merge branch 'develop' into testing - Dymerz (origin/testing, testing)
| | |\
| |/ /
|/| /
| |/
| * 6601f0b - (5 days ago) docker-compose-prod: Update API version - Dymerz (origin/develop, develop)
| * 3b11a86 - (5 days ago) Bot: Remove unnecessary print() - Dymerz
| * 1130b6a - (5 days ago) API: Add users `stars` fields - Dymerz
| * 816264c - (6 days ago) docker-compose: Add database healthcheck - Dymerz
| * ec9e6a5 - (6 days ago) DB: Fix bad configuration permission - Dymerz
| * 8427dfe - (2 weeks ago) docker-compose: update api version - Dymerz
| * 0fb95d0 - (2 weeks ago) API: Fix outdated data from RSI - Dymerz
| * 6a40f1b - (3 weeks ago) API: Fix duplicate members in organization_members - Dymerz
| * acc1578 - (3 weeks ago) API: Fix bad organization data - Dymerz
| * 2858d53 - (3 weeks ago) Remove .gitattributes - Dymerz
| * d99b23e - (3 weeks ago) DB: Resolve LFS conflict on GitHub - Dymerz
| * 24411e8 - (3 weeks ago) Push gamedata scripts using Git LFS - Dymerz
| *   77950ed - (3 weeks ago) Merge branch 'develop' of https://gitlab.com/Dymerz/StarCitizen-API into develop - Dymerz
| |\
| | * 19e856b - (10 weeks ago) Bot: Fix !info and !privilege command - Dymerz
| | * b88a4c9 - (10 weeks ago) Bot: Update Python version - Dymerz
| * | 330133b - (3 weeks ago) DB: Add new gamedata versions (->3.10.2) DB: Update existing gamedata scripts - Dymerz
| |/
| * f9328bc - (2 months ago) docker-compose: Update services version - Dymerz
| * 2cbf379 - (2 months ago) Doc: Add Organization Members - Dymerz
| * 6159e80 - (2 months ago) API: Add organization_members API endpoint - Dymerz
| * 3da04ef - (2 months ago) API: Organization, fix wrong result - Dymerz
| * ed729a2 - (3 months ago) API: Remove debug prints - Dymerz
| * 7d99228 - (3 months ago) Doc: Fix banner size - Dymerz
| * b37c6c6 - (3 months ago) docker-compose-test: Update virtual host url - Dymerz
| * 4cc652d - (3 months ago) Add docker-compose-test - Dymerz
| * 5132111 - (3 months ago) docker-compose: Update services version - Dymerz
| * c98d1c5 - (3 months ago) Doc: Fix typo and update Paypal donation - Dymerz
| * 7076317 - (3 months ago) docker-compose: Remove useless exposed ports - Dymerz
| * 963dfc4 - (3 months ago) Proxy: Add image digest - Dymerz
| * 0d18889 - (3 months ago) API: Cleaning some files/logs - Dymerz
| * 04f055d - (3 months ago) API: Improvements on the Organization feature - Dymerz
| * bcd0ad0 - (3 months ago) API: Integrate the new proxy service - Dymerz
| * 48ce284 - (3 months ago) Add proxy service - Dymerz
| * c142802 - (3 months ago) API: Proxy improvements - Dymerz
| * 99d43a3 - (4 months ago) docker-compose-prod: Update services version - Dymerz
| * f2de3a0 - (5 months ago) docker-compose-prod: Use local volumes instead of files - Dymerz
| * d304e10 - (5 months ago) DB: Improve init script - Dymerz
| * 97fea66 - (5 months ago) DB: Copy configuration in the container - Dymerz
| * 64671fd - (5 months ago) API: Fix missing import - Dymerz
| * 23666cf - (5 months ago) docker-compose: Add shared volume for web sources - Dymerz
| * 890421a - (5 months ago) Doc: Copy configuration in the container - Dymerz
| * e356686 - (5 months ago) Apache: Copy configuration in the container - Dymerz
| * ac10b1e - (5 months ago) API: Fix sid missing in Organization - Dymerz
| * 289afe1 - (6 months ago) API: Fix bad return in getUser - Dymerz
| * bba1ac0 - (6 months ago) API: Fix missing field (name) in organization - Dymerz
| *   64c2c71 - (8 months ago) Merge branch 'hotfix' into develop - Dymerz
| |\
| | * 1ea4774 - (8 months ago) API: Remove bad comments - Dymerz
| | *   0ba9488 - (8 months ago) Merge branch 'develop' into hotfix - Dymerz
| | |\
| | * | e88e5b7 - (9 months ago) Bot: Fix !help message rights - Dymerz
| * | | a51d34a - (8 months ago) docker-compose-prod: Update services version - Dymerz
| * | | bda619e - (8 months ago) Scheduler: Disable bad proxies update - Dymerz
| * | | d90813e - (8 months ago) Scheduler: Update image and dependencies - Dymerz
| * | | 4380b70 - (8 months ago) API: Update image and dependencies - Dymerz
| * | | 3adebb1 - (8 months ago) API: Force update for proxies list - Dymerz
| * | | 05bb3a4 - (8 months ago) Doc: Fix typo in Terms And Conditions - Dymerz
| * | | dd3cab3 - (8 months ago) Doc: Add Star Citizen resources link - Dymerz
| * | | b74a95b - (8 months ago) Doc: Fix features syntax warning - Dymerz
| * | | 9d9f0e8 - (8 months ago) Bot: Update image and dependencies - Dymerz
| * | | 04abf8b - (8 months ago) Apache: Update image - Dymerz
| * | | abaf48b - (8 months ago) DB: Update image - Dymerz
| * | | 9459802 - (8 months ago) Doc: Replace bad example in Advanced features - Dymerz
| * | | 554b860 - (8 months ago) Doc: Extend page content size - Dymerz
| * | | 393c628 - (8 months ago) Doc: Add WEEK timetable to Telemetry - Dymerz
| * | | f379deb - (8 months ago) Doc: Update image and dependencies - Dymerz
| * | | 19d4698 - (8 months ago) Doc: Remove deprecated features - Dymerz
| * | | 9bcac4e - (8 months ago) Doc: Add apikey banner on every pages - Dymerz
| * | | 29c116a - (8 months ago) Doc: Fix bad indentations in examples - Dymerz
| | |/
| |/|
| * | aaf9776 - (8 months ago) docker-compose: Update api version number - Dymerz
| * | 8d900d4 - (8 months ago) API: Change concurrent proxies count from 10 to 15 - Dymerz
| * | b34b64f - (8 months ago) API: Fix and improve members list in organization - Dymerz
| * | 816f6df - (9 months ago) Bot: Fix spelling - Dymerz
| * | e913a34 - (9 months ago) DB: Add gamedata 3.8.1 - Dymerz
| * | 361710f - (9 months ago) DB: Add gamedata 3.8.0 - Dymerz
| * | 38a55d5 - (9 months ago) gitlab-ci: Remove doc generation - Dymerz
| |/
| * 06ae670 - (9 months ago) docker-compose-prod: Update bot version - Dymerz
| *   d05b70c - (9 months ago) Merge branch 'hotfix' into develop - Dymerz
| |\
| | * 8fddc29 - (9 months ago) docker-compose-prod: Fix API version - Dymerz
| | * fd2c1b1 - (9 months ago) Database: Disable scripts restoration (temp fix) - Dymerz
| | * fd54530 - (9 months ago) API: ships, Fix numeric queries API: ships, Optimize cache operations - Dymerz
| | * e979837 - (9 months ago) docker-compose-prod: API, Fix image version - Dymerz
| | * 177edc2 - (9 months ago) Fix merge conflict - Dymerz
| | *   1bf7a54 - (9 months ago) Merge branch 'testing' - Dymerz
| | |\
| | * \   e6b79f9 - (10 months ago) Merge branch 'hotfix' - Dymerz
| | |\ \
| | | * | 6e7d4fc - (10 months ago) API: Fix KeyError in ships - Dymerz
| | * | |   cc35c0d - (10 months ago) Merge branch 'master' of https://gitlab.com/Dymerz/StarCitizen-API - Dymerz
| | |\ \ \
| | | * | | 638b1e8 - (10 months ago) Update .gitignore - Urbain Corentin
| | | * | | 1a552ef - (10 months ago) Delete acme.json - Urbain Corentin
| | * | | |   1b5480e - (10 months ago) Merge branch 'hotfix' - Dymerz
| | |\ \ \ \
| | | |/ / /
| | |/| / /
| | | |/ /
| | * | |   b8be13d - (10 months ago) Merge branch 'hotfix' - Dymerz
| | |\ \ \
| | * \ \ \   7fb721d - (10 months ago) Merge branch 'hotfix' - Dymerz
| | |\ \ \ \
| | * \ \ \ \   0ab7124 - (10 months ago) Merge branch 'hotfix' - Dymerz
| | |\ \ \ \ \
| | * \ \ \ \ \   599a4e2 - (10 months ago) Merge branch 'hotfix' - Dymerz

使用 我发现 Git LFS 是我的问题然后我在 reflog 发现我用过:

git filter-branch --tree-filter 'rm -rf db/src/scripts/gamedata/gamedata*' HEAD

经过一些搜索,我发现可以 Undo git filter-branch

所以,我只需要做:

  • git reset --hard refs/original/refs/heads/master
  • git cherry-pick <commit-id>
  • git push --force

一切正常谢谢!