Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git merge does not take new file

Tags:

git

merge

I have branch A and branch B . I am trying to merge from B to A .

I am on branch A

I run

git merge B

Git merges some stuff. I can see some conflicts and merged files, but there is a file in B which is new (no versions of such file in A) and that file is not taken.

I don't have it in A after merge. Any ideas what am I doing wrong ?

like image 476
ikos23 Avatar asked Feb 10 '26 06:02

ikos23


2 Answers

That can have several reasons:

  1. did you commit all your changes before merging A and B? (Including the file you are missing?)
  2. is there maybe a newer commit in the other branch which deleted this file on purpose?
like image 195
Finkes Avatar answered Feb 15 '26 09:02

Finkes


When you try a git merge if the merge fails you have to resolve conflicts and then commit the resolution you did.

If you will not commit the changes will not be reflected in your repository so no changes will be made.

You will see all the changes only after committing them but git status will show them to you as pending changes.

enter image description here

like image 21
CodeWizard Avatar answered Feb 15 '26 07:02

CodeWizard