Niklas Rosencrantz
Niklas Rosencrantz

Reputation: 26647

Please help me understand the difference between push, commit and when to merge

Please help me since Mercurial makes easy things impossible. I just want to commit my changes.

$ hg com -m 'cleanup'
nothing changed (1 missing files, see 'hg status')

$ hg push
pushing to https://[email protected]/niklasr/montao
http authorization required
realm: Bitbucket.org HTTP
user: niklasr
password: 
searching for changes
abort: push creates new remote head 84d1c2d2b638!
(did you forget to merge? use push -f to force)

$ hg merge
abort: outstanding uncommitted changes
(use 'hg status' to list changes)
dev@dev-OptiPlex-745:~/proj/montao/montaoproject$ 

If I do hg status I get too many files and with question marks. I think I'm the only developer on this project but there might've been some minor update from somebody else, but this is probably just done all from one computer so it's shouldn't become a conflict. But we know how good versioning systems are at creating conflicts for us that were no major conflicts to begin with.

Upvotes: 0

Views: 1940

Answers (1)

Ry4an Brase
Ry4an Brase

Reputation: 78330

This is all explained much better in the mercurial book, but I'll bite.

When you hg push mercurial is warning you that your hg push would create a new head -- a split in history at the remote end if you push without first merging.

When you try to hg merge it's warning you that if you tried to merge you'd be doing so in your working directory which has uncommitted changes.

When you committed it told you that you've deleted a file locally but not committed that (1 missing files). When you ran hg status it's showing you all your many, many un-added files with ? in front of them. You can see just the deleted ones with:

hg status --deleted

You you want that file gone you can do:

hg forget thatfilename
hg commit -m 'commiting a file I removed awhile ago'

and if you'd rather have it back

hg revert thatfilename

now that your working directory is clean you can:

hg merge
hg push

Upvotes: 3

Related Questions