0

I started using gitlab only recently and right now my project has 2 branches. I want to merge branch A into B, both are up to date with their respective origins but after the merge it looks like the content of branch A is from an older version. Any idea why?

mastro
  • 3
  • 4
  • 1
    "Merge" does not mean "make same". If Git says it is up to date, it *is* "up to date" according to the defined results of merging. If those aren't the results you want, what you want isn't a Git merge. You may need to read up on how Git defines the merge verb first. – torek May 09 '22 at 09:41
  • @torek what I don't understand is why git is using older files to make the merge, shouldn't it be using the most recent version? – mastro May 09 '22 at 09:51
  • 1
    That's why I say you need to read up on what `git merge` *means*. It doesn't mean "use the most recent". It means *combine changes*, and to achieve that, we first have to define what it means to *find* changes, given that commits store *snapshots*. See, e.g., [How does 'git merge' work in details?](https://stackoverflow.com/q/14961255/1256452) and my own answer to [How does git compare two files while merging?](https://stackoverflow.com/q/56889406/1256452) – torek May 09 '22 at 09:56
  • If you want a more tailored explanation than torek's helpful hints, you'll need to give more details of what you're seeing. In what way exactly does it "look like the content is from an older version"? Without being able to see your code, it's hard to picture the problem exactly; maybe you can come up with a simplified example? – IMSoP May 09 '22 at 11:10
  • Hi @IMSoP, the easiest example is a line of code I commented with a brief note in a previous commit which after the merge was not present anymore. After reading torek answer I'm pretty sure he's right and git looked for a common starting point between the 2 branches and started merging from there. I guess I need to find another method other than git merge – mastro May 09 '22 at 11:46

0 Answers0