admin管理员组

文章数量:1404622

Here is my workflow with git:

  • A 'master' branch.
  • A 'devel' branch, that I merge into master when it is mature for a new release.
  • Several little branches, such as 'imprimerie', 'ordomatic', etc. Usually I make my commits on 'ordomatic', then I merge into 'devel', and then into 'master'. Everything works fine habitually, but recently I realized that a sery of commits of the branch 'ordomatic' haven't effect, though I have merged them to 'devel' and then to 'master'. Here is the tree for the concerned period (I have put a '!' before 'ordomatic' to mark the commits that are not merged):
* |   096c3c6  (tag: v2.0.6) Merge branch 'devel' BrRoman 21/11/2024 11:47
|\ \  
| * \   a4c5530  Merge branch 'ordomatic' into devel BrRoman 21/11/2024 11:47
| |\ \  
|/ / /  
| * | 119eb64  Ordomatic: todo updated. BrRoman 20/11/2024 19:25
| * | 8c5c99c  Ordomatic: minor corr. BrRoman 20/11/2024 19:25
| * | 4dddc95  Ordomatic: Saint Nom de Marie: added "CM 21". BrRoman 20/11/2024 19:25
| * | a7798da  Ordomatic: ML of Saints of 3d week of September corrected. BrRoman 20/11/2024 19:23
| * | b408cb3  Ordomatic: 2/11 corrected. BrRoman 20/11/2024 19:21
| * | 870ea4c  Ordomatic: "psalmi hebdomadæ…" => "psalmi anni…". BrRoman 20/11/2024 19:19
| * | 369d1b8  Ordomatic: 'ordo_write.py' => 'views.py/write_tex()'. BrRoman 20/11/2024 19:16
| * | b205aa3  Ordomatic: generalities improved. BrRoman 20/11/2024 19:14
| * | c293203  Ordomatic: write_pdf() => write_tex(). BrRoman 20/11/2024 19:13
|/ /  
* |   652271e  (tag: v2.0.5) Merge branch 'devel' BrRoman 14/11/2024 16:31
|\ \  
| * \   6724382  Merge branch 'barcode' into devel BrRoman 14/11/2024 16:31
| |\ \  
| | * | 13948b8  Barcode: added qrcode and improved barcode. BrRoman 14/11/2024 16:26
| * | |   0f749fc  Merge branch 'ordomatic' into devel BrRoman 14/11/2024 16:30
| |\ \ \  
| | * | | 9c1768c  !Ordomatic: lectiones.py: formatting. BrRoman 14/11/2024 04:45
| | * | | 3f7fa78  !Ordomatic: lectiones.py: biblical refs refreshed. BrRoman 14/11/2024 04:37
| | * | | 797bacd  !Ordomatic: todo refreshed. BrRoman 07/11/2024 17:39
| | * | | 32af6c8  !Ordomatic: saint Thérèse d'Avila simplified. BrRoman 07/11/2024 17:39
| | * | | 6bdca85  !Ordomatic: transfiguration: force = 90 always. BrRoman 07/11/2024 17:12
| | * | | 04beefb  !Ordomatic: various.py: tabs => spaces. BrRoman 07/11/2024 17:03
| | * | | 264f9a4  !Ordomatic: commemorations at Lauds in Lent. BrRoman 07/11/2024 16:39
| | * | | 377f9ad  !Ordomatic: 2/11: readings corrected. BrRoman 06/11/2024 19:20
| | * | | 36f426f  !Ordomatic: 2/11: rm report jeûne. BrRoman 06/11/2024 19:18
| * | | |   822b58e  Merge branch 'imprimerie' into devel BrRoman 14/11/2024 16:29
| |\ \ \ \  
| | |_|/ /  
| |/| | |   
| | * | | fb39280  Imprimerie: devis: + forfait coupe papier. BrRoman 06/11/2024 19:16
| | * | | 36d43d7  Imprimerie: 'Prix remise' => 'Prix remisé'. BrRoman 06/11/2024 16:43
| * | | | 8a61741  Todo refreshed. BrRoman 14/11/2024 08:31
| * | | | bd2f7e0  Home: 'infos' removed. BrRoman 06/11/2024 19:02
* | | | |   a4a7fa3  (tag: v2.0.4) Merge branch 'devel' BrRoman 05/11/2024 12:43
|\ \ \ \ \  
| |/ / / /  
| * | | |   2141429  Merge branch 'imprimerie' into devel BrRoman 05/11/2024 12:43
| |\ \ \ \  
| | |/ / /  
| | * | | 1d803f7  Imprimerie: form.py updated. BrRoman 05/11/2024 12:43
| | * | | 0f5e40b  Imprimerie: paper: + sheets_by_pack. BrRoman 05/11/2024 12:43
* | | | |   6648c32  (tag: v2.0.3) Merge branch 'devel' BrRoman 05/11/2024 12:29
|\ \ \ \ \  
| |/ / / /  
| * | | |   3d56e92  Merge branch 'imprimerie' into devel BrRoman 05/11/2024 12:29
| |\ \ \ \  
| | |/ / /  
| | | / /   
| | |/ /    
| |/| |     
| | * | 68f23a7  Imprimerie: paper: + price_full. BrRoman 05/11/2024 12:27
| |/ /  
| * |   431c868  Merge branch 'livrets' into devel BrRoman 05/11/2024 07:37
| |\ \  
| | * | 9245a36  Livrets: no Tierce 2 November. BrRoman 27/10/2024 19:10
| * | |   7443a4b  Merge branch 'ordomatic' into devel BrRoman 05/11/2024 07:37
| |\ \ \  
| | * | | 4df0e05  Ordomatic: proper parts for 2025 (defunts, semailles…). BrRoman 05/11/2024 07:24
| | * | | 12aa272  Ordomatic: write tex file: + 'encoding=utf-8'. BrRoman 05/11/2024 07:23
| | * | | dcfd527  Ordomatic: even_year calculation simplified. BrRoman 05/11/2024 07:22
| | * | | 6847f74  Ordomatic: Christmas and Holy Family: psalms. BrRoman 05/11/2024 07:21
| | * | | b7e43ca  Ordomatic: rm space above 'Sacrum Triduum Paschale'. BrRoman 05/11/2024 07:20
| | * | | f3f5e8d  Ordomatic: saint Charles 4/11: rm ant. Benedictus. BrRoman 05/11/2024 04:50
| | * | | 8dba818  Ordomatic: 2/11: if sunday: rm vigiles, gloria Patri, complies. BrRoman 05/11/2024 04:48
| | * | | f714389  Ordomatic: hebdo_psalt_inv. BrRoman 05/11/2024 04:42
| | * | | 13d9528  Ordomatic: psalmi ad Vigilias in sol. et festis. BrRoman 02/11/2024 18:40
| | * | | cd41730  Ordomatic: some spaces corrected. BrRoman 31/10/2024 19:18
| | * | | d98e3b8  Ordomatic: spaces removed before [:;!?]. BrRoman 31/10/2024 17:04

I work only on local, without contributors, and that I push everything to Github (, where you can see full tree) only as a backup copy.

I tried to merge the branch 'ordomatic' into 'master' via 'devel'.

It seems that my commits do not take effect on 'master'.

Aren't these commits merged via 0f749fc and 652271e? What can I do now to merge them, or to have them take effect?

New trial

I have tried to checkout before the first missed commit, and then to rebase the last one:

git ck 822b58e # Checkout to branch 'devel' before the first problematic commit on 'ordomatic'.

Result:

M   abbaye/apps/accenteur/static/accenteur/accenteur-github
Note: checking out '822b58e'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:

  git checkout -b <new-branch-name>

HEAD is now at 822b58e Merge branch 'imprimerie' into devel

Then I rebase the last problematic commit:

git rebase 9c1768c

Result:

First, rewinding head to replay your work on top of it...
Applying: Imprimerie: paper: + price_full.
Applying: Imprimerie: paper: + sheets_by_pack.
Applying: Imprimerie: form.py updated.
Applying: Imprimerie: 'Prix remise' => 'Prix remisé'.
Applying: Home: 'infos' removed.
Applying: Imprimerie: devis: + forfait coupe papier.
Applying: Todo refreshed.
Using index info to reconstruct a base tree...
M   TODO.md
Falling back to patching base and 3-way merge...
Auto-merging TODO.md
CONFLICT (content): Merge conflict in TODO.md
error: Failed to merge in the changes.
Patch failed at 0007 Todo refreshed.
hint: Use 'git am --show-current-patch' to see the failed patch

Resolve all conflicts manually, mark them as resolved with
"git add/rm <conflicted_files>", then run "git rebase --continue".
You can instead skip this commit: run "git rebase --skip".
To abort and get back to the state before "git rebase", run "git rebase --abort".

Here I resolve the conflict and then:

git add TODO.md

git rebase --continue

Now HEAD is detached and 7 commits ahead 'devel' and 'master':

* c976033  (HEAD) Todo refreshed. BrRoman 14/11/2024 08:31
* 04f9577  Imprimerie: devis: + forfait coupe papier. BrRoman 06/11/2024 19:16
* e67e666  Home: 'infos' removed. BrRoman 06/11/2024 19:02
* f162541  Imprimerie: 'Prix remise' => 'Prix remisé'. BrRoman 06/11/2024 16:43
* 37fcd5c  Imprimerie: form.py updated. BrRoman 05/11/2024 12:43
* 05491f5  Imprimerie: paper: + sheets_by_pack. BrRoman 05/11/2024 12:43
* b5497fc  Imprimerie: paper: + price_full. BrRoman 05/11/2024 12:27
| * 9f6d849  (master, devel) Todo: added crontab, vimrc; corr. evince bailly. BrRoman 27/03/2025 18:05
| * 9a18a19  Module calendar: corr. ref tempo in lent. BrRoman 27/03/2025 18:04
| * 7cd42d5  (livrets) Livrets: added prayer super_populum qua_1_6. BrRoman 27/03/2025 18:02
| * b7497ea  Livrets: added super_populum in lent. BrRoman 27/03/2025 18:02
| * f6fa7a2  (origin/livrets, ordomatic) Todo: some keybindings added/updated. BrRoman 10/03/2025 18:44
| * 74b2b0b  (origin/monks, origin/master, origin/devel, monks) Moines and absences: migrations reset. BrRoman 08/03/2025 12:41
| *   3117db6  (origin/infirmerie, origin/imprimerie, origin/hotellerie, infirmerie, imprimerie, hotellerie) Merge branch 'monks' into devel BrRoman 08/03/2025 12:30
| |\  
| | * 7d4ba9e  Moines: migration (civil names removed). BrRoman 08/03/2025 09:12
| * |   0d3ce10  Merge branch 'infirmerie' into devel BrRoman 08/03/2025 09:15
| |\ \  
| | * | 5ec92fe  Infirmerie: migration (created models). BrRoman 08/03/2025 09:15
| | * | 477f883  Infirmerie: forms and models modified (removed Moine and Datetimepicker). BrRoman 08/03/2025 09:14
| | |/  
| * | 5fb226a  Todo updated (Booklets: Quadragesima). BrRoman 07/03/2025 18:25
| |/  
| *   a81fcfa  (tag: 2.0.17, origin/ordomatic, origin/barcode, origin/accenteur, origin/absences, barcode, accenteur, absences) Merge branch 'master' into infirmerie BrRoman 07/03/2025 10:40
| |\  

So far so good: I find the old commits again, that is to say files are modified on disk.

Yes, but the problem is inverted: all commits more recent than c976033 (between 14/11/2024 and today) are lost…

Now, if I merge 'master' into HEAD or if I try 'git checkout master' and then 'git reset --hard c976033', I lose again my ancient commits and find again the recent ones (after resolving a conflict).

Here is my workflow with git:

  • A 'master' branch.
  • A 'devel' branch, that I merge into master when it is mature for a new release.
  • Several little branches, such as 'imprimerie', 'ordomatic', etc. Usually I make my commits on 'ordomatic', then I merge into 'devel', and then into 'master'. Everything works fine habitually, but recently I realized that a sery of commits of the branch 'ordomatic' haven't effect, though I have merged them to 'devel' and then to 'master'. Here is the tree for the concerned period (I have put a '!' before 'ordomatic' to mark the commits that are not merged):
* |   096c3c6  (tag: v2.0.6) Merge branch 'devel' BrRoman 21/11/2024 11:47
|\ \  
| * \   a4c5530  Merge branch 'ordomatic' into devel BrRoman 21/11/2024 11:47
| |\ \  
|/ / /  
| * | 119eb64  Ordomatic: todo updated. BrRoman 20/11/2024 19:25
| * | 8c5c99c  Ordomatic: minor corr. BrRoman 20/11/2024 19:25
| * | 4dddc95  Ordomatic: Saint Nom de Marie: added "CM 21". BrRoman 20/11/2024 19:25
| * | a7798da  Ordomatic: ML of Saints of 3d week of September corrected. BrRoman 20/11/2024 19:23
| * | b408cb3  Ordomatic: 2/11 corrected. BrRoman 20/11/2024 19:21
| * | 870ea4c  Ordomatic: "psalmi hebdomadæ…" => "psalmi anni…". BrRoman 20/11/2024 19:19
| * | 369d1b8  Ordomatic: 'ordo_write.py' => 'views.py/write_tex()'. BrRoman 20/11/2024 19:16
| * | b205aa3  Ordomatic: generalities improved. BrRoman 20/11/2024 19:14
| * | c293203  Ordomatic: write_pdf() => write_tex(). BrRoman 20/11/2024 19:13
|/ /  
* |   652271e  (tag: v2.0.5) Merge branch 'devel' BrRoman 14/11/2024 16:31
|\ \  
| * \   6724382  Merge branch 'barcode' into devel BrRoman 14/11/2024 16:31
| |\ \  
| | * | 13948b8  Barcode: added qrcode and improved barcode. BrRoman 14/11/2024 16:26
| * | |   0f749fc  Merge branch 'ordomatic' into devel BrRoman 14/11/2024 16:30
| |\ \ \  
| | * | | 9c1768c  !Ordomatic: lectiones.py: formatting. BrRoman 14/11/2024 04:45
| | * | | 3f7fa78  !Ordomatic: lectiones.py: biblical refs refreshed. BrRoman 14/11/2024 04:37
| | * | | 797bacd  !Ordomatic: todo refreshed. BrRoman 07/11/2024 17:39
| | * | | 32af6c8  !Ordomatic: saint Thérèse d'Avila simplified. BrRoman 07/11/2024 17:39
| | * | | 6bdca85  !Ordomatic: transfiguration: force = 90 always. BrRoman 07/11/2024 17:12
| | * | | 04beefb  !Ordomatic: various.py: tabs => spaces. BrRoman 07/11/2024 17:03
| | * | | 264f9a4  !Ordomatic: commemorations at Lauds in Lent. BrRoman 07/11/2024 16:39
| | * | | 377f9ad  !Ordomatic: 2/11: readings corrected. BrRoman 06/11/2024 19:20
| | * | | 36f426f  !Ordomatic: 2/11: rm report jeûne. BrRoman 06/11/2024 19:18
| * | | |   822b58e  Merge branch 'imprimerie' into devel BrRoman 14/11/2024 16:29
| |\ \ \ \  
| | |_|/ /  
| |/| | |   
| | * | | fb39280  Imprimerie: devis: + forfait coupe papier. BrRoman 06/11/2024 19:16
| | * | | 36d43d7  Imprimerie: 'Prix remise' => 'Prix remisé'. BrRoman 06/11/2024 16:43
| * | | | 8a61741  Todo refreshed. BrRoman 14/11/2024 08:31
| * | | | bd2f7e0  Home: 'infos' removed. BrRoman 06/11/2024 19:02
* | | | |   a4a7fa3  (tag: v2.0.4) Merge branch 'devel' BrRoman 05/11/2024 12:43
|\ \ \ \ \  
| |/ / / /  
| * | | |   2141429  Merge branch 'imprimerie' into devel BrRoman 05/11/2024 12:43
| |\ \ \ \  
| | |/ / /  
| | * | | 1d803f7  Imprimerie: form.py updated. BrRoman 05/11/2024 12:43
| | * | | 0f5e40b  Imprimerie: paper: + sheets_by_pack. BrRoman 05/11/2024 12:43
* | | | |   6648c32  (tag: v2.0.3) Merge branch 'devel' BrRoman 05/11/2024 12:29
|\ \ \ \ \  
| |/ / / /  
| * | | |   3d56e92  Merge branch 'imprimerie' into devel BrRoman 05/11/2024 12:29
| |\ \ \ \  
| | |/ / /  
| | | / /   
| | |/ /    
| |/| |     
| | * | 68f23a7  Imprimerie: paper: + price_full. BrRoman 05/11/2024 12:27
| |/ /  
| * |   431c868  Merge branch 'livrets' into devel BrRoman 05/11/2024 07:37
| |\ \  
| | * | 9245a36  Livrets: no Tierce 2 November. BrRoman 27/10/2024 19:10
| * | |   7443a4b  Merge branch 'ordomatic' into devel BrRoman 05/11/2024 07:37
| |\ \ \  
| | * | | 4df0e05  Ordomatic: proper parts for 2025 (defunts, semailles…). BrRoman 05/11/2024 07:24
| | * | | 12aa272  Ordomatic: write tex file: + 'encoding=utf-8'. BrRoman 05/11/2024 07:23
| | * | | dcfd527  Ordomatic: even_year calculation simplified. BrRoman 05/11/2024 07:22
| | * | | 6847f74  Ordomatic: Christmas and Holy Family: psalms. BrRoman 05/11/2024 07:21
| | * | | b7e43ca  Ordomatic: rm space above 'Sacrum Triduum Paschale'. BrRoman 05/11/2024 07:20
| | * | | f3f5e8d  Ordomatic: saint Charles 4/11: rm ant. Benedictus. BrRoman 05/11/2024 04:50
| | * | | 8dba818  Ordomatic: 2/11: if sunday: rm vigiles, gloria Patri, complies. BrRoman 05/11/2024 04:48
| | * | | f714389  Ordomatic: hebdo_psalt_inv. BrRoman 05/11/2024 04:42
| | * | | 13d9528  Ordomatic: psalmi ad Vigilias in sol. et festis. BrRoman 02/11/2024 18:40
| | * | | cd41730  Ordomatic: some spaces corrected. BrRoman 31/10/2024 19:18
| | * | | d98e3b8  Ordomatic: spaces removed before [:;!?]. BrRoman 31/10/2024 17:04

I work only on local, without contributors, and that I push everything to Github (https://github/BrRoman/abbaye, where you can see full tree) only as a backup copy.

I tried to merge the branch 'ordomatic' into 'master' via 'devel'.

It seems that my commits do not take effect on 'master'.

Aren't these commits merged via 0f749fc and 652271e? What can I do now to merge them, or to have them take effect?

New trial

I have tried to checkout before the first missed commit, and then to rebase the last one:

git ck 822b58e # Checkout to branch 'devel' before the first problematic commit on 'ordomatic'.

Result:

M   abbaye/apps/accenteur/static/accenteur/accenteur-github
Note: checking out '822b58e'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:

  git checkout -b <new-branch-name>

HEAD is now at 822b58e Merge branch 'imprimerie' into devel

Then I rebase the last problematic commit:

git rebase 9c1768c

Result:

First, rewinding head to replay your work on top of it...
Applying: Imprimerie: paper: + price_full.
Applying: Imprimerie: paper: + sheets_by_pack.
Applying: Imprimerie: form.py updated.
Applying: Imprimerie: 'Prix remise' => 'Prix remisé'.
Applying: Home: 'infos' removed.
Applying: Imprimerie: devis: + forfait coupe papier.
Applying: Todo refreshed.
Using index info to reconstruct a base tree...
M   TODO.md
Falling back to patching base and 3-way merge...
Auto-merging TODO.md
CONFLICT (content): Merge conflict in TODO.md
error: Failed to merge in the changes.
Patch failed at 0007 Todo refreshed.
hint: Use 'git am --show-current-patch' to see the failed patch

Resolve all conflicts manually, mark them as resolved with
"git add/rm <conflicted_files>", then run "git rebase --continue".
You can instead skip this commit: run "git rebase --skip".
To abort and get back to the state before "git rebase", run "git rebase --abort".

Here I resolve the conflict and then:

git add TODO.md

git rebase --continue

Now HEAD is detached and 7 commits ahead 'devel' and 'master':

* c976033  (HEAD) Todo refreshed. BrRoman 14/11/2024 08:31
* 04f9577  Imprimerie: devis: + forfait coupe papier. BrRoman 06/11/2024 19:16
* e67e666  Home: 'infos' removed. BrRoman 06/11/2024 19:02
* f162541  Imprimerie: 'Prix remise' => 'Prix remisé'. BrRoman 06/11/2024 16:43
* 37fcd5c  Imprimerie: form.py updated. BrRoman 05/11/2024 12:43
* 05491f5  Imprimerie: paper: + sheets_by_pack. BrRoman 05/11/2024 12:43
* b5497fc  Imprimerie: paper: + price_full. BrRoman 05/11/2024 12:27
| * 9f6d849  (master, devel) Todo: added crontab, vimrc; corr. evince bailly. BrRoman 27/03/2025 18:05
| * 9a18a19  Module calendar: corr. ref tempo in lent. BrRoman 27/03/2025 18:04
| * 7cd42d5  (livrets) Livrets: added prayer super_populum qua_1_6. BrRoman 27/03/2025 18:02
| * b7497ea  Livrets: added super_populum in lent. BrRoman 27/03/2025 18:02
| * f6fa7a2  (origin/livrets, ordomatic) Todo: some keybindings added/updated. BrRoman 10/03/2025 18:44
| * 74b2b0b  (origin/monks, origin/master, origin/devel, monks) Moines and absences: migrations reset. BrRoman 08/03/2025 12:41
| *   3117db6  (origin/infirmerie, origin/imprimerie, origin/hotellerie, infirmerie, imprimerie, hotellerie) Merge branch 'monks' into devel BrRoman 08/03/2025 12:30
| |\  
| | * 7d4ba9e  Moines: migration (civil names removed). BrRoman 08/03/2025 09:12
| * |   0d3ce10  Merge branch 'infirmerie' into devel BrRoman 08/03/2025 09:15
| |\ \  
| | * | 5ec92fe  Infirmerie: migration (created models). BrRoman 08/03/2025 09:15
| | * | 477f883  Infirmerie: forms and models modified (removed Moine and Datetimepicker). BrRoman 08/03/2025 09:14
| | |/  
| * | 5fb226a  Todo updated (Booklets: Quadragesima). BrRoman 07/03/2025 18:25
| |/  
| *   a81fcfa  (tag: 2.0.17, origin/ordomatic, origin/barcode, origin/accenteur, origin/absences, barcode, accenteur, absences) Merge branch 'master' into infirmerie BrRoman 07/03/2025 10:40
| |\  

So far so good: I find the old commits again, that is to say files are modified on disk.

Yes, but the problem is inverted: all commits more recent than c976033 (between 14/11/2024 and today) are lost…

Now, if I merge 'master' into HEAD or if I try 'git checkout master' and then 'git reset --hard c976033', I lose again my ancient commits and find again the recent ones (after resolving a conflict).

Share Improve this question edited Mar 29 at 15:08 BrRoman asked Mar 11 at 9:54 BrRomanBrRoman 271 silver badge5 bronze badges 5
  • 1 What do you mean? 0f749fc merges those commits. – evolutionxbox Commented Mar 11 at 10:02
  • Maybe off-topic, but I want to point out that a commit in the history does not always effect the current revision. Its changes could have never been introduced (by git merge -s ours), or could have been reverted. – ElpieKay Commented Mar 11 at 11:43
  • If HEAD(c976033) is correct, just git checkout master and git reset --hard c976033. Note that in the general case you should be careful with a git reset --hard. – Weijun Zhou Commented Mar 28 at 9:57
  • @evolutionxbox: Thanks for your answer. Yes, 0f749fc merges those commits. But everything happens like if they were not merged = the code isn't modified. It happens only for this series of 9 commits (those I have marked with a '!' in front). – BrRoman Commented Mar 29 at 14:54
  • @WeijunZhou: Thanks for your reply. In fact, HEAD (c976033) isn't perfectly correct, because it doesn't take in consideration the more recent commits. That is to say: modifications of code since c976033 (14/11/2024) aren't written on disk. If I make what you advise me (git checkout… git reset --hard) or if I merge master into HEAD, the problem is inverted: I lose my old commits and retrieve the recent ones. (I have edited my question in this sense, at the bottom.) – BrRoman Commented Mar 29 at 15:10
Add a comment  | 

1 Answer 1

Reset to default 5

Based on trying your repo locally:

By checking out the code and looking at the merge commit in question, we can see that it doesn't have any file diff:

$ git clone [email protected]:BrRoman/abbaye.git
$ cd abbaye
$ git show --format=fuller --first-parent 0f749fc  # No file diff => an empty merge commit.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
commit 0f749fc0e6385f12b4a4ee7bca1245a06d6d40dc ┃
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┻━━━━━━━
Merge: 822b58e 9c1768c
Author:     BrRoman <[email protected]>
AuthorDate: Thu 2024-11-14 19:30
Commit:     BrRoman <[email protected]>
CommitDate: Thu 2024-11-14 19:30

    Merge branch 'ordomatic' into devel

When checking out 822b58e and merging 9c1768c into it, some merge conflicts appear:

$ git switch --create ordo-test 9c1768c
$ git switch --create devel-test 822b58e
$ git merge ordo-test
Auto-merging TODO.md
CONFLICT (content): Merge conflict in TODO.md
Recorded preimage for 'TODO.md'
Automatic merge failed; fix conflicts and then commit the result.

It's very likely that those conflicts caused the developer in question to mess up and accidentally create an empty merge commit, discarding all changes from the ordomatic branch. This could have happened by for example running these commands after the merge:

$ git restore --staged .  # Unstage everything.
$ git restore --ours .    # Ignore all changes from the merged branch.
$ git merge --continue    # Continue the merge (save the commit message file in editor).

本文标签: gitWhy do some merged commits have no effectStack Overflow