Using GIT for Dataflex Development: Difference between revisions

(Created page with "== Why Version control == Before we jump into GIT in specific, it is important to mention some reasons why developers are more productive when using version control; * We can kee...")
 
Line 36: Line 36:
=== Creating your first repository ===
=== Creating your first repository ===
Let’s create a GIT repository of the Visual Dataflex example Order Entry workspace. This workspace always is clean when VDF is installed but in my case, full of test and other changed code after a while. Being able to go back to the original version seems like a good idea for a first repository.
Let’s create a GIT repository of the Visual Dataflex example Order Entry workspace. This workspace always is clean when VDF is installed but in my case, full of test and other changed code after a while. Being able to go back to the original version seems like a good idea for a first repository.
Start with navigate to and select the workspace directory then use the right click (short cut) menu, and select ‘Git Init Here’ as below.
Start with navigate to and select the workspace directory then use the right click (short cut) menu, and select ‘Git Init Here’ as below.


[[File:Example.jpg]]
[[File:UsingGitforVdfDev_image001.png]]
 
The Git Init takes about a second. In this second it initialised a local repository in this work directory. You find that a subsequent right mouse click on the same directory now shows a different short cut menu;
 
[[File:UsingGitforVdfDev_image002.png]]
Inside the Order Entry directory you see a new hidden directory ‘.git’. This directory contains the whole local repository. So if you would delete this, the repository is gone.
 
Although the repository is created, it has not added any of our files. For this to happen we need to stage the files and then commit. We do this in the following steps;
 
Go back to the workspace directory and select ‘Git Gui’ from the shortcut menu on the Order Entry directory.
 
[[File:UsingGitforVdfDev_image003.png]]
 
Git Gui will start like below
 
[[File:UsingGitforVdfDev_image004.png]]
 
Panel 1 shows all files that are detected to differ from the repository. As the repository is empty, this means this list contains all files. Clicking on a file name (not the icon) shows in panel 3 the changes compared with the repository version
 
Panel 2 has the files that you have indicated you want to stage for commit. Clicking on the icon of a file in Panel 1, shifts the file from Panel 1 ‘Unstaged Changes’ to panel 2 ‘Staged Changes’.
 
If this starts to sound all too complicated bare with me, it is really not that hard and there are very good reasons for doing the staging this way
 
When you look at the files in Panel 1, the Unstaged Changes, you find that it has a number of files you do not want to track such as IDESrc/Workspace.loc, possibly files in the data directory etc.
 
We can teach GIT what files to ignore by placing a file called .gitignore in the workspace directory. The content of the file is;
<nowiki>
#Exclude the following files for Visual DataFlex Projects
####################################
programs/*.exe
programs/*.dbg
programs/*.exe.manifest
programs/webapp.log
appsrc/*.dep
appsrc/*.fld
appsrc/*.pbg
appsrc/*.pdp
appsrc/*.pkd
appsrc/*.prp
appsrc/*.err
data/*.cch
ddsrc/*.bak
idesrc/studiometadata.mtd
idesrc/workspace.loc
 
vssver2.scc
nppbackup
 
#personal preference
####################################
appsrc/*.prn
idesrc/*.dsk
</nowiki>
 
So create this file in notepad, insert  the above content and save with filename’.gitignore’ as sibling next to the ‘Order Entry.sws’ file.
 
If you kept Git Gui open, use the ‘Rescan’ button (or F5 key) and confirm that the unwanted files are no longer shown in the list of Unstaged changes.
 
Ok, now it’s time to stage all not to be ignored files. You can either select each file in Panel 1, by clicking its icon,  use the shift key to select multiple and use Ctrl+T Stage to commit, or click ‘Stage changed’ button (that I marked with ‘A’ in the screenshot).
 
Now enter the Initial Commit Message like ‘VDF 17.0 Order entry sample as released by Data Access’. And click the ‘Commit’ button (marked with ‘B’ in my screenshot).
 
You noticed that the commit was really quick, and all panels are blank. You have just created a new repository, told GIT what files to ignore, and committed all other files into the repository.
71

edits