Specs for parts on Giant Defy 4 (2013) to decide on upgrades to transfer parts onto another bike
Really, the only thing you can do is investigate each individual part as you go along. 

With drivetrain parts you'll have to investigate how well they work with other drivetrain parts. E.g., if you change the derailleur, does it work with the shifters? Is the cassette compatible with the derailleurs? Etc. Try searching the site for stuff like drivetrain compatibility, shifter compatibility, and derailleur compatibility. The venerable Sheldon Brown is also a magnificent source for determining how things work together.

With fairly static parts like your handlebars and seatpost, it will likely come down to simply measuring to see if they match. You'll probably need to do so with calipers as these things can sometimes vary by a millimeter, or perhaps even less. However, Batman mentions in the comments, you may run into comfort issues. Whether these issues are within your range of tolerance will depend on your bike's setup, your body proportions, flexibility, and the individual parts that you're swapping.