Will it be updated from mercurial, will it replace my changes?

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

hg pull
hg update

The problem is that from my last update I modified some files for myself. Now the problem of updating from the repository will overwrite my changes. How can I prevent this?

+5
source share
1 answer

hg pull just retrieves a new story, so it will not affect uncommitted changes.

hg update will be updated to the end, but uncommitted changes will be merged with the new parent.

You will not lose anything, although the merge tool can work if there are conflicts in the merge.

, , hg update -C "" , .

. (0) . (1) .

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"

( ) .

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

, . hg st , , hg ci.

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

. , "Line5" "Line3" . .

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

!

Mercurial: .

+8

All Articles