Rock mechanics is a theoretical and applied science of the mechanical behavior of rocks and rock masses.
Compared to geology, it is the branch of mechanics concerned with the response of rock and rock masses to the force fields of their physical environment.
Rock mechanics is part of a much broader subject of geomechanics, which is concerned with the mechanical responses of all geological materials, including soils.
Rock mechanics is concerned with the application of the principles of engineering mechanics to the design of structures built in or on rock. The structure could include many objects such as a drilling well, a mine shaft, a tunnel, a reservoir dam, a repository component, or a building. Rock mechanics is used in many engineering disciplines, but is primarily used in Mining, Civil, Geotechnical, Transportation, and Petroleum Engineering.
Rock mechanics answers questions such as, "is reinforcement necessary for a rock, or will it be able to handle whatever load it is faced with?"  It also includes the design of reinforcement systems, such as rock bolting patterns.
Before any work begins, the construction site must be investigated properly to inform of the geological conditions of the site. Field observations, deep drilling, and geophysical surveys, can all give necessary information to develop a safe construction plan and create a site geological model. The level of investigation conducted at this site depends on factors such as budget, time frame, and expected geological conditions. 
The first step of the investigation is the collection of maps and aerial photos to analyze. This can provide information about potential sinkholes, landslides, erosion, etc. Maps can provide information on the rock type of the site, geological structure, and boundaries between bedrock units.
Creating a borehole is a technique that consists of drilling through the ground in various areas at various depths, to get a better understanding of the sites geology. Boreholes must be spaced properly from one another and drilled deep enough to provide accurate information for the geological model. Samples from the borehole are investigated and factors such as rock type, degree of weathering, and types of discontinuities are all recorded. 
Testing the properties of a rock is essential to understand how stable or unstable it is. Rock mechanics involves 3 categories of testing methods: tests on intact rocks, discontinuities and rock masses.
Two direct methods of testing that can be done are laboratory tests and in-situ tests. There are also indirect methods of testing which involve correlations and estimations that are obtained by analyzing field observations. The data these testing methods provide are crucial for the design, structure and research of rock mechanics and rock engineering.
Intact rocks and discontinuities can be tested in the laboratory through running small-scale experiments to gather empirical data, however rock masses require some larger-scale field measurements rather than laboratory work due to their more complex nature.
Laboratory tests provide both classification and characterization of the rock as well as a determination of what rock properties will be used in the engineering design. Examples of some of these laboratory tests include: sound velocity tests, hardness tests, creep tests and tensile strength tests. In-situ tests, which is when the rock being studied is subjected to a heavy load and then being watched to see if it deforms, provides an insight into what impacts a rock masses' strength and stability.
Understanding the strength of a rock mass is difficult but necessary for ensuring the safety of anything built on or around it, and it all depends on different factors the rock mass faces, such as the environmental conditions, size of the mass, and how discontinued it might be.