Monday, May 16, 2011

mercurial init - git init - summary clone and push

hg init            or      git init

...are generally the first commands I use.


Have your code ready and a reasonable directory structure in place.

Add a README and a LICENSE file (OSI approved licenses in my case)

hg init

...and you are up and running (for your git stuff   git init)

If you are working from an existing codebase then you might want 'clone'

hg clone http://hg.savannah.nongnu.org/hgweb/someproject


Publishing one time projects via git lends itself well to a set recipe:

  1. git init
  2. git add .
  3. git commit -m 'first commit of GPL3 licensed python scripts'
  4. git remote add origin git@github.com:someuser/apt-utils-python-shell.git
  5. git push -u origin master
          [ Above we used -u switch (--set-upstream) which is correct ]
  6. git add README
  7. git commit -m 'added some to README'
  8. git push origin master
          [ Note there is no -u switch here which is correct ]

Openshift and git - what commands there?

In order to commit to your new project, ...

Make your changes, then run:

git commit -a -m 'Some commit message'
git push

Then reload this page

Note: The above is quoted from the openshift page


Notes and further reading:

If you feel the desire to host your own Mercurial from which other folks can pull, then:


hg serve 

and the point browser at http://localhost:8000/


Note: If your machine is internet facing rather than on a private company network, then you should think about authentication / security, and follow this guide:
  Setting up a Mercurial CGI server

Alternatively you could think about Trac



If you feel the desire to host your own Git from which other folks can pull, then:

git-daemon 

and the point browser at http://localhost:9418/

Note: If your machine is internet facing rather than on a private company network, then you should think about authentication / security, and read up about gitosis or gitweb.


1 comment:

Gary said...

hg rollback

to revert changes that have been commited to the local repository but not been pushed to another repository yet.

You can only rollback the last hg command.

hg revert - when to use