hg force update to new files

36,774
hg update --clean

This will update your working directory with the newest version of files in the current branch. Please note that this command will discard all existing changes in your working directory.

If you meant "can I get a fresh copy of each and every file from the repository" just delete all files in your working directory and do a hg update --clean again.

Share:
36,774
prathmesh.kallurkar
Author by

prathmesh.kallurkar

Prathmesh Kallurkar is a research scholar in the Computer Science and Engg. department at IIT Delhi. He is working under the guidance of Dr. Smruti R. Sarangi towards his PhD thesis, "Architectural Support For Operating Systems". His primary research interests include futuristic computer architecture suited for operating systems, better OS designs, and, virtualization solutions for cloud. He is in the core developement team of the open source architectural simulator Tejas, and a member of the Srishti research group. He has instrumented the open source emulator Qemu to generate full system (includes operating system, and application) execution trace.

Updated on October 09, 2022

Comments

  • prathmesh.kallurkar
    prathmesh.kallurkar over 1 year

    I am using hg version 1.9.1. Problem is whenever I use hg update, I get an option of updating changed files. Do we have an option for forcefully updating all files to their new versions in the latest commit. Sorry but i did not find any useful information in hg manual.

  • prathmesh.kallurkar
    prathmesh.kallurkar over 12 years
    how does mercurial implement "hg update --clean" ?? Do they check for the changed files and then update them to new copies or they just blindly update all files to new version. The later option can be very costly i guess ..
  • Benjamin Anderson
    Benjamin Anderson almost 10 years
    Thanks for this answer. This is what worked for me. hg update -C
  • CodeFox
    CodeFox over 8 years
    @BenjaminAnderson, the arguments -C und --clean are effectively the same. See hg help update: -C --clean discard uncommitted changes (no backup)