Question-and-Answer Resource for the Building Energy Modeling Community
Get started with the Help page
Ask Your Question
6

Git setup with OpenStudio

asked 2015-04-02 12:42:25 -0600

updated 2015-07-10 20:57:40 -0600

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
edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
5

answered 2015-04-02 13:54:56 -0600

updated 2015-04-02 13:55:14 -0600

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.

edit flag offensive delete link more

Comments

1

I wish I could upvote that feature request

ericringold's avatar ericringold  ( 2015-04-02 14:23:50 -0600 )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 -0600 )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 -0600 )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 -0600 )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 -0600 )edit
2

answered 2015-04-02 13:06:55 -0600

updated 2015-04-02 13:12:01 -0600

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/
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Training Workshops

Careers

Question Tools

4 followers

Stats

Asked: 2015-04-02 12:42:25 -0600

Seen: 186 times

Last updated: Apr 02 '15