0

I'm working on a project and I used to merge but this one is quite confuse.

Here the way I'm working on:

git branching

Here my problem, as you can see the red line, the merge comes with more than 600 commits (all my commits actually)

I have tried merging and rebasing and each time it wants to push 600 commits, I have also recovered missing commits manually using cherry-pick from hotfix to pick missing commits made.

It has been awhile since I worked in this project maybe I've missed something...

EDIT 1:

Here what's going on when I try to merge merge-fail

EDIT 2:

Here a part of my git log, the last successful merge of develop into hotfix is 0ba9488 (note that if I merge into master the same problem occurs and not in 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

Dymerz
  • 153
  • 2
  • 9
  • It's a little difficult to tell by the figure you've provided - Can you share some output from git commands running this scenario? Sounds like you can reproduce it. – zrrbite Oct 14 '20 at 22:16
  • Thanks, I've edited my post, I don't really know which logs are helpful to show – Dymerz Oct 15 '20 at 06:51
  • Why do you merge `develop` to `hotfix` branch? If you'd like to implement hotfix, then it is better to create based on `develop` branch. When `hotfix` branch was created? And if you'd follow `git flow` model, then `hotfix` branches are created from `master` branch, and then merged back into `master`, and `develop`. Summarizing: at what point of time did you create `hotfix` branch? – kosist Oct 15 '20 at 06:53
  • I know it's not the way to go, in fact I've demonstrated with `hotfix` but it does the same on `master` and other branches, it's like `develop` is completely different. `hotfix` is quite old in fact but deleting this branch would not be the solution since it also happen when I merge `develop` into `master` – Dymerz Oct 15 '20 at 07:13
  • @Dymerz could not understand the issue here? If there are ~600 commits made in develop after hotfix branched out, it is totally fine for so many commits to be pushed. – Prasanna Oct 16 '20 at 16:15
  • @Prasanna no, it merging every commits I've made since the "init commit". it's like `develop` isn't the base branch of `hotfix` – Dymerz Oct 17 '20 at 01:18
  • @Dymerz got it. Did any of the branch rewrite history? Did you check if a common commit exist in both the branches? Can you include the git log output for both the branches before the merge? – Prasanna Oct 17 '20 at 02:10
  • @Prasanna I don't really know if I rewrote the history but its seems to be the problem, thanks for helps btw. (post edited) – Dymerz Oct 18 '20 at 00:27
  • 1
    @Dymerz, based on the log history, I am suspecting LFS migration might have rewrote the history. Around commit, 24411e8, did you do lfs migrate without "--no-rewrite" option. That might be the cause – Prasanna Oct 18 '20 at 20:04
  • @Prasanna Ho yes.. I think you're right, I didn't understand the consequences by omitting the `--no-rewrite` but yeah it's seems to be the cause, so what do you recommend ? – Dymerz Oct 18 '20 at 23:12
  • @Dymerz, One option is to find the last commit before lfs migrate, revert to it and reapply the changes. This time we need to do lfs migrate with "--no-rewrite" flag. Couple of concerns here. 1) Finding the last commit before lfs is difficuilt (Your current git log shows the rewritten commit) 2) For lfs migrate, you may not get the full space advantage if you dont rewrite history. Since you have rewritten develop branch, my suggestion would be to do the same now for hotfix and master branches, if you dont see any other issues. – Prasanna Oct 18 '20 at 23:44

1 Answers1

2

With the help of Prasanna I found that Git LFS was my problem and then I dug in my reflog and found that I've used:

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

After some searches I found that it's possible to Undo git filter-branch.

So, I've just had to do:

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

And it's all working thanks!

Dymerz
  • 153
  • 2
  • 9