Git

From Net-SNMP Wiki
Revision as of 23:39, 26 May 2011 by Wes (Talk | contribs) (Committing the changes)

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.

Learning Git

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

Git work flows