Source code control when authoring?

This older thread with git commands and tips may be of interest: Git (or other open-source) hints/tips?

3 Likes

I use source control for more or less everything, from config files for the home router on up. Once you get in the habit, the overhead is so minimal that it’s worth it even if the chances of needing it (to recover an old version or to identify when a particular change was made or whatever) are small.

I do end up using branching a lot in development of any programming project, game or otherwise. Basically I usually start out with a very raw prototype branch where I’ve got all the canonical “best practices” (modularity, code re-use, and so on) in the back of my mind, but I don’t sweat it too much.

Then at some point I look at what I have and can better identify what’s actually, in this particular game/project, a one-off and what’s a general case that I’m going to re-use throughout the game. And at that point I start a new branch, moving all of the “general case” stuff off into its own library (or whatever).

This is something that probably works better (in the IF authoring domain) in TADS3, which makes it easy to split things up–nearly whenever I implement a new behaviour for an object or NPC or whatever, it goes in its own source file. And this makes it easier to sorta grab a bunch of capabilities and decide that they should be living in their own library instead of in a specific NPC or whatever.

3 Likes

I’ve bookmarked the idiot’s guides above for future reference!

I’d quite like to upload the source code of my one adventure game to Github (publicly), and work on it and others using git on my computer, but have a completely separate Github account for interactive fiction than for other things. Could you recommend a further guide for that? I’ve searched the internet in the past for this but for some reason just didn’t quite understand the answers, or at least not enough to give it a go.

2 Likes

Sounds like you’re low on coffee. (snicker)

Haha yeah probably not far from the truth. Thanks for spotting that one :smile:

It probably shouldn’t be too hard to create one git account with one gmail address and one with another. Then you could, say, log onto your work-in-progress/creativity account on Firefox and the technical one (e.g. using Python) with the other.

Though I don’t know if 2 accounts are necessary. Github’s private repositories let you keep stuff away from public view if you want, and of course, you don’t ever have to push a local repo to the web.

But on the other hand, you don’t have to write a grant proposal to have two separate Github accounts. However you want to learn about git that works best for you is how you should go about things.

Can it be set up so that you don’t need a password for both accounts. Ie it “knows” from the particular repo which user you need?

With Gitlab and Github too, you can have “groups”, which look like separate accounts as far as URLs are concerned. This is how Friends of Inform 7 · GitHub works.

It depends how you want to separate your IF stuff from your other stuff. If you’re happy for one account to be seen to be committing to both, you can just give the second account access to the first account’s repositories.

If you want no trace to link the accounts, that’s possible, but it would require setting quite a few things. You’d need to change both who is seen as authoring a commit, as well as who pushes the commits to the web repo. I’ve never tried to do that so I’m not sure how tricky it is, but probably not too tricky. Git is intended to be flexible.

I have two github accounts, one for school/work and one just for IF. It was kind of complicated to get it working and I’m honestly not sure if this would work today. And this method is probably terribly insecure. But here’s my setup on linux.

There are two lines in ~/.git-credentials:

https://<username1>:<pat1>@github.com
https://<username2>:<pat2>@github.com

where pat1 and pat2 are personal access tokens as created using these steps.

In order to associate a git repository with a specific github account, I add the following lines to .git/config within the repo’s main folder:

[user]
    name = <username>
    email = <email>

Also, change the [remote "origin"] url to https://<username>@github.com/....

4 Likes

Wow. thank you very much. this is what i need.

I literally save my backups for the game on Google Drive, with a .txt file detailing the most recent update.:person_shrugging:

I am starting to regret that I didn’t go down this path when I started working my way through Creating Interactive Fiction with Inform 7 this past November. Now that I’m nearing the end of the book, I’m considering the merits of creating the game a second time using git to record notes and lessons learned via the commit log.

Today I created an initial repository with a new Inform 7 project and uploaded it to my GitHub repo.

Is there a published standard .gitignore for Inform 7 users?

If not, does anyone recommend extensions or folders I can or should ignore in my Inform 7 project when I push commits to GitHub?

UPDATE ------------------------------------------------------------

Alas, I should have searched before posting. There is a thread that discusses .gitignore recommendations here.

6 Likes