-2

If I commit a new line, and then merge to a commit that doesn't have that line, will the line be deleted? I'm making an update system for something and I'm using git merge as a way to do it easily. I have user specific data I put into a new line, so when I merge I don't want it to be deleted.

phd
  • 82,685
  • 13
  • 120
  • 165

1 Answers1

1

No, merging should not lose changes you've made in local commits. All a merge does is introduce a new local commit that has two parents, so should contain changes introduced by both sets of commits.

If you push your merge commit, you'll also push any ancestor commits, so your unpushed commit will be pushed at that point.

If the two sets of commits introduce changes that clash, it is up to you to resolve that conflict.

I'm making an update system for something and I'm using git merge as a way to do it easily.

This is a bit vague, but it sounds like a bad idea. It sounds like you're going to keep a local working copy with a different history and continually merge in upstream? That would lead to a very ugly history that keeps diverging from upstream.

SpoonMeiser
  • 19,918
  • 8
  • 50
  • 68