4. Fixing Problems in Git

Using Git is usu­al­ly an easy-going, sim­ple expe­ri­ence. Stage, com­mit, push, pull, merge. Most days every­thing works just as it should. But some­times it doesn’t. And when things go wrong we want to have the tools avail­able to fix it.

In this sec­tion we will cov­er some tech­niques we can use to fix prob­lems in Git, like:

  • How to revert changes you’ve made in the repos­i­to­ry using git-revert.
  • How to reset the state of a branch using git-reset.
  • How to find where a prob­lem was intro­duced using git-bisect.

These three tech­niques, along with the oth­er knowl­edge you’ve gained so far in the course, will help you nav­i­gate Git when things go wrong.