Git

From Net-SNMP Wiki
Revision as of 23:48, 26 May 2011 by Wes (Talk | contribs) (Notes on the htdocs repository)

Jump to: navigation, search

Git is a version control system (VCS) that is based on a distributed architecture. In May, 2011 the Net-SNMP project will switch from SVN to Git.

Checking out the Net-SNMP Git Tree

Select a git MODULE:

  • htdocs

Check it out anonymously (read-only access):

 git clone git://net-snmp.git.sourceforge.net/gitroot/net-snmp/MODULE

Checking it out if you're a developer:

 git clone ssh://USERNAME@net-snmp.git.sourceforge.net/gitroot/net-snmp/MODULE

Other critical initial setup

In order to make sure your email address and name are correct:

 git config user.email "YOURSFACCOUNTNAME@users.sourceforge.net"
 git config user.name "YOUR NAME"

Making changes

This is where you type vi or emacs or if you're a real developer who likes to get dirty perl -i -p -e ...

Committing the changes

 git commit -m "commit message" FILES

Or if you want to commit everything in a directory and down, use a directory name instead of FILES.

Or if you want to commit everything anywhere in the repo, use the -a switch.

NOTE: this only commits them to your local copy of the repository. This is different than SVN, if you're more familiar with SVN. Next you need to push them to the master repository:

Pushing the changes upstream

Once you're sure your commits are safe themselves, push them upstream to the master repository on sourceforge:

 git push origin master

Assuming you followed the instructions above, and didn't cloning from somewhere else first, you should be able to shorten this to:

 git push

And you're done!

Notes on the htdocs repository

The htdocs module, which contains the Net-SNMP website, is only synchronized from the git repository once an hour. It may take up to an hour before the changes take effect on the website.

Creating tags and branches

Tagging

Tags are simply a symbolic way of remembering "a point in time" that is easier than the sha1 hash that is more frequently seen.

 git tag my-really-super-feature-works

for example will create the above tag.

XXX: discuss annotated/signed/etc tags

Pushing tags

By default, git push doesn't push tags. IE, it *only* pushes code. If you've created a tag and you want it pushed upstream, you'll need to push it manually:

 git push origin TAGNAME

Or you can push all your tags:

 git push --tags

Note: Please don't push personal tags... Use the individual push instead if you're creating helpful personal tags.

Learning Git

If you're starting out learning Git, here are some useful resources:

Git work flows