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.
-
Please add concrete examples of the problem: tho code on both branches before merging, and after merging. – Martin Meeser Nov 21 '18 at 14:24
-
[Understanding Merge a Little Better](https://stackoverflow.com/a/46708899/7976758). – phd Nov 21 '18 at 16:39
1 Answers
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.

- 19,918
- 8
- 50
- 68