
Photoshop won’t delete hidden layers in this case.
You can use the command Merge Visible, Ctrl + Shift + E (Windows), or Cmd + Shift + E (Mac) and all the visible layers will be merged. Photoshop will ask if you want to discard hidden layers (if any) and combine the images. Select Layer then Flatten Image option from the top menu. There are a few different ways to merge different layers in Photoshop: Check again that your mask is accurate and finally merge the two layers. By creating the mask, you will be able to eliminate the parts of the top layer you don’t want to see. Select the top layer and click on the Add Vector Mask option from the Layers panel for adding a mask. Add The Layer Mask And Erase The Unwanted Parts Now, change the blend mode of the top layer back to Normal from Overlays. Press Enter when you’re done with the positioning of your top layer. Therefore, be careful and avoid moving your camera or the subject. In case your main subject gets disturbed, it will become difficult to match both the photos. Make enough use of resize handles to shrink, enlarge or rotate the top layer so that both layers look alike.
Using it, align the top image to make it look perfect. Now, press Ctrl+T (Windows) or Cmd+T (Mac) on your keyboard to select the Move option. This way, you can align the main subject in both images precisely. For this, select the Overlay option for the top image so that you can see the second layer easily.
How to merge two photos in Photoshop: Align The Photos