There are a few good resources available on this subject if you Google "salesforce continuous integration" - see eg. this post by Jeff Douglas.
The simple version is:
- Set up a git repository on Bitbucket
- Use the Force.com IDE, MavensMate or the Force.com Migration Tool to pull metadata files from your Salesforce instance
- Use SourceTree to commit your metadata files to your git repository
You now have your metadata managed with a source control system.
To deploy your code to another org, you need to pull it from the repository, and push it to the target org. You can pull using git commands, and push using the Force.com Migration Tool.
Continuous Integration involves building your code frequently, so that you know as soon as possible if your changes break your existing unit tests. However, it's not much fun to manually pull and push the code every time you make a commit.
Hence, Jenkins is a useful automation tool that can be used to pull your code from your repository and push it to the target org with a single click. You can also set it up to remove the need for manual invocation, eg by monitoring the repository for new commits and deploying them to the target org automatically.