That happened to me a lot. Fortunately most of the time I was able to remember when I already had someone on my tree when their name came up again, so I could just use the connect function. Sometimes I then still had duplicates that I had to remove manually. Now each person who shows up in the tree several ways now has a symbol on the bottom where I can view the other line.
I was assuming you were talking about the online version, so if you are using FTB this may not apply. If you click the Add sign on the left part of a person's pink/blue card there is an option to connect to an existing person.
It does this in the on-line tree MODERN VIEW. If you use FTB you have the option to merge these people with the attach/detach function, but this is tricky and you have to be careful. I don't know if this can be done if you have an on-line tree only.