Git makes it easy to integrate changes from a remote repository into your local repository when collaborating with other developers. However, permanently changing the history of your local branch to match the history of a remote branch is a more complex process. In this video, Chad Thompson demonstrates how to first clean out untracked changes in your local repository and then fetch the latest version of the remote repository. Novice Git developers will then learn how to use the reset command to bring their local branch in line with the state of the remote branch.

Advance your Git skills with Safari Learning Paths.

Chad Thompson is a software developer and DevOps specialist with nearly 20 years of experience creating web applications and supporting web infrastructure. Recently, Chad has been embracing and implementing “infrastructure as code” applications and supporting customer facing web, API, and mobile apps. Chad has devoted his expertise to leading organizations in transforming applications and processes, first for the web and now the cloud. Holding a master’s degree in physics from the University of Iowa, Chad has been creating web applications since the early days of HTML and is certified in Puppet, Oracle, and Amazon Web Services technologies.

Article image: Screen from "How do I force overwrite local branch histories with Git?" (source: O'Reilly).