Getting a repository: hg clone
mkdir ~/sandbox cd ~/sandbox hg clone http://bitbucket.org/ahmadia/amcs291 amcs291-master hg clone amcs291-master amcs291 cd amcs291
Initial Mercurial setup: the .hgrc file
open my_hgrc mv my_hgrc ~/.hgrc
Making changes to a repository: hg commit
open quotes.txt # put your favorite quote in hg status hg commit # or hg commit -m "added quote by XXX"
Synchronizing with the upstream repository
Everything so far has been a local operation that doesn't require a remote connection to the repository at all (in this case, the 'remote' repository is really on the same local file system, but I digress). But what if we want to share our changes with other developers?
Lets see what changes we will make to amcs291-master if we 'push' our changes upstreams from amcs291.
Remember, you cloned a clone!!! Your amcs291 repository points to amcs291-master, which in turn points to http://bitbucket.org/ahmadia/amcs291
Again, hg outgoing is the first networked command you've typed since hg clone.
Sending results upstream: hg push
Once you're ready to send your results upstream, use the hg push command.
Adding files: hg add
echo "My favorite book" >> books.txt touch boooks.txt hg status hg add b*.txt hg status hg forget boooks.txt rm boooks.txt hg commit -m "added my favorite book" hg diff echo "My second favorite book" >> books.txt hg status hg diff hg commit -m "added my second favorite book"
Merges happen when two branches are combined in the same repository. This happens rarely in non-distributed version control systems, but it is a fact of life when using distributed version control.
If you cannot push
hg push searching for changes abort: push creates new remote heads! (did you forget to merge? use push -f to force)
Do NOT force the push.
Check the 'incoming' changes
Pull the incoming changes down into your repository
If Aron doesn't get this far... start here: http://hginit.com/04.html