Conservation and breeding programmes aim at maintaining most diversity, therefore avoiding deleterious effects of inbreeding while maintaining enough variation from which traits of interest can be selected. Theoretically, most diversity is maintained using optimal contributions based on many markers to calculate coancestries, but this can decrease fitness by maintaining linked deleterious variants. The heterogeneous patterns of coancestry displayed in pigs make them an excellent model to test these predictions. We propose methods to measure coancestry and fitness from resequence data, and use them in population management. We analysed resequencing data of Sus cebifrons, a highly endangered porcine species from the Philippines, and genotype data from the Pietrain domestic breed. By analysing the demographic history of Sus cebifrons we inferred two past bottlenecks that resulted in some inbreeding load. In Pietrain, we analysed signatures of selection possibly associated with commercial traits. We also simulated the management of each population to assess the performance of different optimal contribution methods to maintain diversity, fitness and selection signatures. Maximum genetic diversity was maintained using marker-by-marker coancestry, and least using genealogical coancestry. Using a measure of coancestry based on shared segments of the genome achieved best results in terms of diversity and fitness. However, this segment-based management eliminated signatures of selection. We demonstrate that maintaining both diversity and fitness depends on the genomic distribution of deleterious variants, which is shaped by demographic and selection histories. Our findings show the importance of genomic and next-generation sequencing information in the optimal design of breeding or conservation programmes.