Source Control with GIT and BitBucket

gitSource Control: Trust me on this – you do need it! The best tool is GIT – and it’s free  :-) Add BitBucket (or GitHub) and your code will be backed-up and accessible from everywere.

Native GIT runs from a command prompt, so store your projects in a folder close to the root, e.g. C:\dev\projectname

Beware: To use GIT you must understand GIT – get the full story in this guide, or start with this tutorial

I use GIT on my own projects, making hourly commits and daily pushes to BitBucket. If I need to branch or merge code, I use the tools in BitBucket or GIT Extensions

FIrst-time installation and configuration

  1. Download and install GIT (Installation guide)
  2. Setup GIT – apply your username and email address by using these commands:
     $ git config --global "John Doe"
     $ git config --global

    or just manually update the .gitconfig file (in your local folder, e.g. C:\Users\$USER). My file looks like this

     name = Jakob Majkilde
     email =
     proxy =
     autocrlf = true
     excludesfile = c:/dev/.gitignore

    Notice: only the [user] is mandatory – other settings are optional

  3. Add a .gitignore file to automatically exclude files that you do not want in your repository (e.g. .exe files or log files). Read the documentation for more info. I have my ignore file in my developement folder and made it global

Starting a new project

  1. Open a command prompt, goto your project folder and type GIT init (this will create a hidden sub folder called .git)

Often used commands

  • Add files: GIT add -A
  • Commit: GIT commit -m “Type a message here”
  • Status: GIT status
  • Commit log: GIT Log
    git log --graph --pretty --oneline --abbrev-commit

Push to a remote repository (e.g.BitBucket)

  • Connect: git remote add origin<project name>.git (url can be copied from your bitbucket repository)
  • Push: git push -u origin master
  • Pull: git pull origin master 


One thought on “Source Control with GIT and BitBucket

  1. Pingback: Source Control i Domino med GIT/BitBucket |

Leave a Reply

Your email address will not be published. Required fields are marked *