6

Git setup with OpenStudio

I'm using git as a revision control and collaboration tool for my energy models.

I'm having problems configuring it correctly to track the files I want.

First, git doesn't appear to be capable of doing a diff on the .osm. Is it encoded in UTF-16 or something? (I can, however, do an external diff using WinMerge, but it's only a workaround in my mind)

UPDATE: I solved second issue

Has anybody successfully achieved any of those two?


Second issue for the record

Second, I seem to be absolutely incapable of tracking what's happening in the subdirectories openstudio creates to go along with the .osm file. If my file is myfile.osm, I can't track what's going on in directory myfile/. In particular, I'd at least would like to track the myfile/scripts so that my colleagues can see and use the scripts I created.

I've tried a lot of things in my .gitignore:

# ==============================================
# Original setup: ignore all but the gitignore
# ==============================================

*
!.gitignore

# =========================
# OpenStudio
# =========================

!*.osm
!*.rb

# Do not ignore subfolder
!myfile/scripts*
!myfile/scripts/
!myfile/scripts/*
!myfile/scripts/enable_dcv_and_vfd_fan*
!myfile/scripts/enable_dcv_and_vfd_fan/*
!myfile/scripts/enable_dcv_and_vfd_fan/measure.rb
Julien Marrec's avatar
29.7k
Julien Marrec
asked 2015-04-02 12:42:25 -0500
__AmirRoth__'s avatar
4.4k
__AmirRoth__
updated 2015-07-10 20:57:40 -0500
edit flag offensive 0 remove flag close merge delete

Comments

add a comment see more comments

2 Answers

5

Hey @Julien Marrec you may find this feature request amusing.

You can absolutely use git to track changes to OSM and script files, these files will diff just fine. Git can track the binary OSP and run.db files but won't be able to diff them nicely. If I were you I would have a gitignore that contained only:

/run/

That way you won't commit simulation results to your repo.

macumber's avatar
12k
macumber
answered 2015-04-02 13:54:56 -0500, updated 2015-04-02 13:55:14 -0500
edit flag offensive 0 remove flag delete link

Comments

1

I wish I could upvote that feature request

ericringold's avatar ericringold (2015-04-02 14:23:50 -0500) edit

Ahah, pie in the sky :) I'm always throwing random stuffs, and the ignore all then unignore some has the advantage of allowing me to use the same gitignore for eQuest, pure E+ and now OpenStudio projects (also happens to work with my Python coding, etc). But I realize ignore myfile/run only isn't such a bad idea at all.

Are you saying you can diff the .OSM file within git? because I can't

Julien Marrec's avatar Julien Marrec (2015-04-03 02:23:35 -0500) edit

You absolutely can diff OSMs with git, here is an OSM in our repo. What git client are you using (command line tools, TortoiseGit, something else)? I'd imagine any issue is with the diff GUI provided by your client, I know TortoiseGit has a nice diff GUI.

macumber's avatar macumber (2015-04-03 10:36:28 -0500) edit

I can't see the diff within my client, Sourcetree... Strange. I can however see it in Bitbucket, my online repo, by the same company as Sourcetree, Atlassian.

Julien Marrec's avatar Julien Marrec (2015-04-04 08:23:37 -0500) edit

Well I can't help you with the Sourcetree GUI because I've never used it. You might check if you can pick the diff tool that it uses. TortoiseGit comes with its own diff viewer but you can change (e.g. to WinMerge) it if you like.

macumber's avatar macumber (2015-04-04 09:09:45 -0500) edit
add a comment see more comments
2

For the second one, I think I'm just a git-moron, and git-status (and/or Sourcetree) was also leading me into error (closing and reopening SourceTree is needed for it to show properly...)

Anyway, here's what works.

# ==============================================
# Original setup: ignore all but the gitignore
# ==============================================

#Anchor the ignore
/*
!.gitignore

# =========================
# OpenStudio
# =========================

!*.osm
!*.rb
!*.xml

# If you want to ignore all but the scripts folder
#Unignore first level
!/myfile/
#Reignore the rest of the content
/myfile/*
#Unignore second level
!/myfile/scripts/

# If you want to not ignore the entire folder
!/myfile2/
Julien Marrec's avatar
29.7k
Julien Marrec
answered 2015-04-02 13:06:55 -0500, updated 2015-04-02 13:12:01 -0500
edit flag offensive 0 remove flag delete link

Comments

add a comment see more comments