Using Git with Domino Designer - the hardcore way

Posted on

This is a first part of posts on version control with Git for Notes developers. I’m writing it as an addendum to my BLUG 2012 session “Version control for Notes developers”.

Version control for Domino Designer projects - using command line Git (aka the HARDCORE way)

Designer 8.5.3 has built-in capability to link NSF/NTF files with so called on-disk projects that can be used by version control systems. That alone is not enough to successfully use version control systems directly from Designer. But it is enough to use them from the command line! From now on I’m assuming that you’ve created on-disk project out of one of your NSF/NTF files and this on-disk project is called “git_test”.

EDIT: I was wrong, you should install EGit plugin to let DDE know that on-disc project is under version control and that it should not sync .git folder to NSF and back to ODP, more about this here.

1. Install Git for Windows

You can download Git for Windows here. Simply run downloaded file and leave all settings in default values. Of course you can adjust these settings if you know what you’re doing :) This should add Git Bash icon to your desktop. Double click it to open the Bash prompt.

2. Start using it

On-disk project is just folder with files and sub-folders within your workspace folder. Start Git Bash, go to workspace folder under your Notes/data (i.e. cd "C:\Program Files\ibm\lotus\notes\data\workspace"), locate the folder with the name of the on disk project (in our case type cd git_test) and type git init, followed by git add -A and git commit -a -m 'initial import'". After execution of these commands your on-disk project is “saved” to the Git repository located in “.git” subfolder.
git init creates empty repository,
git add -A adds all the files in current folder (and all subfolders) to git’s index and
git commit -a actually saves current state of all those files to the repository (Git tracks changes only in files that has been added to its index).
After you make some changes to original NTF/NSF, switch back to command line prompt and simply type git add -A followed by git commit -a -m "here put your comment". If you omit -m parameter, Git will open text editor for you to enter your comment there.
Every time you create a new design element you have to add it to Git’s index by typing git add _name_of_file_.
More advanced usage is to select what changed files are going to be commited, not commiting them all. This is convenient in case you’ve made some changes to several design elements but you want to have those changes saved as two separate steps (commits). For example if you’ve fixed two bugs or added two new features (or more, of course).
Instead of git commit -a you can use git commit _name_of_file1_ _name_of_file2_ ... -m "here put your commit description"

To find out what files has been modified and/or added you can use command git status

In the next part I’ll show you how to install and use git-flow and how to tweak your command prompt to show you some valuable information about the state of your on-disk project’s repository.
Stay tuned…