Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6885705
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T05:40:04+00:00 2026-05-27T05:40:04+00:00

I use hg command to update a project from repository (mercurial repository). hg pull

  • 0

I use hg command to update a project from repository (mercurial repository).

hg pull
hg update

Problem is that from my last update, I modified some files for myself. Now the concern is updating from repository will overwrite my changes. How can I prevent that?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T05:40:04+00:00Added an answer on May 27, 2026 at 5:40 am

    hg pull just retrieves new history, so would not affect uncommitted changes.

    hg update will update to the tip, but uncommitted changes are merged with the new parent.

    You won’t lose anything, although your merge tool may run if there are conflicts in the merge.

    Note, however, that hg update -C, will "cleanly" update to the tip, throwing out uncommitted modifications.

    Example

    Create a simple two-changeset database. The first changeset (0) has two lines. The second changeset (1) has four lines.

    C:\>md example
    C:\>cd example
    C:\example>hg init
    C:\example>echo Line1 >file.txt
    C:\example>echo Line2 >>file.txt
    C:\example>hg ci -Am "first checkin"
    adding file.txt
    C:\example>echo Line3 >>file.txt
    C:\example>echo Line4 >>file.txt
    C:\example>hg ci -Am "2nd checkin"
    

    Update back to the first (earlier) changeset with two lines.

    C:\example>hg update 0
    1 files updated, 0 files merged, 0 files removed, 0 files unresolved
    C:\example>type file.txt
    Line1
    Line2
    

    Make a change to the file by adding another line. hg st shows that a change has been made, but it hasn’t been committed with hg ci yet.

    C:\example>echo Line5 >>file.txt
    C:\example>hg st
    M file.txt
    

    Now update to the newer changeset. For this case, the merge tool will open because "Line5" conflicts with "Line3" in this new changeset. I resolved the merge and saved.

    C:\example>hg update
    merging file.txt
    0 files updated, 1 files merged, 0 files removed, 0 files unresolved
    C:\example>type file.txt
    Line1
    Line2
    Line3
    Line4
    Line5
    

    Nothing lost!

    Also check out Mercurial: The Definitive Guide and other Beginner’s Guides.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I use this command to copy all files whose names start with 'file' from
I'm using Hudson to build my project from my Mercurial repository. There are two
When I use make command, like make mica2, in TinyOS. The following problem will
for example i use following command to find a record SELECT `users`.`mail` FROM `users`
I have a .Net 3.5 class library project that I've migrated to use Visual
I have implemented some utility classes in Flex that I want to use in
After updating my sdk tools I cannot build my project from the command line.
I'm learning how to use the command line by requirement for a recent project.
How can I use command line arguments in a creationComplete event handler? It seems
You can use command lsof to get file descriptors for all running processes, but

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.