Git is a version control program. It keeps a track of what changes were done across various commits.
For example: You can see the changes that I had done to my Auto-correct program over at revisions: *github.com/SathyaBhat/StackEd/commits/master/
Having version control is incredibly useful - if you screw up your program to a bad extend, you can always rollback to the last good commit. Have multiple branches, a stable branch where everything's always fine, a new-features branch where you can test out new features & so on.
You'll need to install git.
Git Book - Installing Git
Once you've installed it, you'll have to setup git
Help.GitHub - Set Up Git
Help.GitHub - Set Up Git
To start working with git, you'll have to initialize the repo first:
Code:
cd code/myjavaproject/
git init
Next add the files you want to track:
Once you've reached a point where you think you can come back to anytime, you'll want to create a commit
Code:
git commit -m "Message about what changes were done so far"
Now you'll want to push the changes to a remote server, SourceForge in this case (I'd recommend GitHub though)
Chose the below article, based on whatever you are using
Forge / documentation / Git - Beta
Git ? sourceforge
Once the remote has been setup (the part which does that is:
Code:
git remote add origin ssh://USERNAME@PROJECTNAME.git.sourceforge.net/gitroot/PROJECTNAME/REPONAME
git config branch.master.remote origin
)
you'll need to push the local changes to server:
There you go, your program's tracked by git, and pushed to SF.
Next time you do any change to the files which are being tracked, git will identify that.
You can see the status by typing
on the directory where the git repo is.
To commit the changes, just add the files & do a git commit. (As shown).
The CLI seems daunting at first, but you'll get used to it. If you want a nice GUI I'd recommend Git Extensions for Windows or QGit for Linux.