How to collaborate on Construct projects with GitHub

56

Index

Stats

22,008 visits, 63,354 views

Tools

Translations

This tutorial hasn't been translated.

License

This tutorial is licensed under CC BY 4.0. Please refer to the license text if you wish to reuse, share or remix the content contained within this tutorial.

Published on 1 Apr, 2020. Last updated 12 Sep, 2024

Adding collaborators

Your other team-mates also need to get access to your repository. You can add collaborators in the Settings section of your repository on the GitHub website. Note there may be limits depending on your account tier. For more details on inviting collaborators, see GitHub's help on Inviting collaborators to a personal repository.

Once you've invited a collaborator, they should also be able to access the repository on the GitHub website. Then the process is similar to when you first created the repository: download and install GitHub Desktop, then on the website click Clone or download, then Open in Desktop. As before they can choose a local folder to clone the repository to, and it'll download all the project files there. Then they're all set up to push and pull changes the same way you do.

Receiving other changes

You'll frequently want to receive any other changes made to the repository if you have other team-mates making changes.

All you need to do is click Pull origin (sometimes also shown as Fetch origin) in GitHub Desktop to pull any new changes back from the server to your local working copy. However whenever you do this, make sure you have closed your project in Construct. This will update your project files but Construct won't see that they've changed, and next time you press 'Save' you might revert the changes and end up with a mess. Making sure you've closed your project guarantees you won't accidentally overwrite anything, and ensures that when you next open it, Construct will reflect all the latest updates in the editor.

GitHub Desktop can also alert you if there are changes waiting to be pulled from the server, as shown below. Clicking Pull origin will receive those changes - but as noted be sure to make sure your Construct project is closed before doing that.

Thanks to the magic of source control, this will also merge changes with your own files. This is a key feature of source control. Providing you have not changed the same files in the same places, everything should just automatically merge in to a single coherent project.

Conflict resolution

What happens if two people do modify the same part of the same file at the same time? This creates a conflict.

Conflicts are something you should aim to avoid at all costs, since they can easily be complicated and confusing. You should avoid working on the same parts of the project at the same time wherever possible. However they can end up happening accidentally from time to time anyway.

As an example, suppose two people commit a change to the project description. One person changes it to "My awesome project!", commits it and pushes it to the server. Then a second person changes it to something different, like "My SUPER awesome project!", commits that, and attempts to push it to the server. GitHub Desktop will stop the second person pushing because it knows there are changes it hasn't received yet. So it will require you to pull first.

This is where the conflict happens. The second person sees a conflict because they have their own change to the project description, but they are trying to receive a different change to the project description. Which description is supposed to be there? This cannot be automatically resolved, so it has to ask you to fix it.

You will have to manually to resolve this. Often the easiest solution is to abort the merge, then revert your local changes. You can revert a commit in the History section.

However in some cases you will have a lot of changes and you don't want to lose all that work. So alternatively you can manually edit the file to resolve the conflict. The default suggestion is to use Visual Studio Code, a coding editor, to edit the file as text. (You'll need to download and install that first to use it.) It has special support for handling conflicts. In this case it opens the project file with the conflicting description in VS Code, and then if you scroll down it highlights the conflict and also provides options on how to resolve it:

If you know what you are doing, you can edit the text manually. However the easiest way to solve it is to click either:

  • Accept Current Change: use the change you were trying to commit. Remember it's the second person who is resolving the conflict, so this means the second description is used, overwriting the first description.
  • Accept Incoming Change: use the change from the repository. This means the first person's description is used, overwriting the second description.

In this case we'll do with Accept Current Change, so the second description is used. It's possible there will be other conflicts in the file too, so you may need to scroll through the file and fix them all. Once everything is resolved, save the file and close it. GitHub now identifies that there are no conflicts left, so now Commit merge is enabled and you can now continue to pull the changes from the repository.

Note the way GitHub handles this is it adds a second commit that deals with merging the conflict. Then you can finally push your change, and the project is updated on the server.

A good way to review what happened is to look at the commit history on the GitHub website. You can view a list of each commit in the order they were pushed, and see the differences in the files they changed.

  • 19 Comments

  • Order by
Want to leave a comment? Login or Register an account!
  • I've been waiting for this. Thank you finally!!

  • As a solo dev hesitant to jump into source control, your tutorial was a game-changer! Now I'm excited to finally integrate it into my workflow and open the door to future collaboration. Thanks for making it so approachable!

  • Very useful and succinct tutorial on using source control via GitHub. thank you.

  • Very cool, when using this though, if I modify the position of an object or add new object etc, changes appear in my GIT commit list. However if I change a tilemap, adding or removing tiles, those changes do not appear in the commit list.

      • [-] [+]
      • 2
      • Ashley's avatar
      • Ashley
      • Construct Team Founder
      • 2 points
      • (3 children)

      All changes should appear in your commit list. If changes do not appear, then you have not saved the project, and the changes won't be there when you next open the project either.

      • I've tested a few times, certainly saving the project - if I move an object and save, it appears. If I modify a tilemap and save then nothing appears in the commit list.

        What's interesting is if I edit the tile map and then do something like move an objects position, when I commit the changes the tile map edits are saved. So that data is being captured, its just if I edit the tilemap and do nothing else, git thinks I've made no edits to the project and nothing appears in the commit list.

          • [-] [+]
          • 0
          • Ashley's avatar
          • Ashley
          • Construct Team Founder
          • 0 points
          • *
          • (0 children)

          Tilemap data is saved in the corresponding layout JSON file, so check for changes there. Maybe GitHub Desktop isn't checking there or something, or perhaps you forgot to add the files in the first place.

      • Recorded a quick video showing the issue: youtu.be/QRjykEozW-U

  • Scirra has since enforced updates upon any user.

    This breaks version control more often than not, and leads to losing time and resources.

    I tried reasoning with them on a thread to no use, even though any other user agreed a toggle in options or at the very least an advanced Chrome parameter was necessary.

    There is a workaround I discovered recently:

    1. Go to the editor version url (editor.construct.com/rXXX)

    2. Three dots Chrome menu -> More tools -> Create Shortcut (open as new window)

    3. Pin this window to your taskbar.

    This way, you can actually control when you want your team to upgrade.

    In case anyone at Scirra cares, the same issues I talked about in the thread you dismissed are still ongoing and affect Github workflows.

      • [-] [+]
      • 2
      • Ashley's avatar
      • Ashley
      • Construct Team Founder
      • 2 points
      • *
      • (3 children)

      You can choose which version of Construct you use on our releases page.

      Everyone on the team needs to be on the same version of Construct, because save files are not backwards compatible. So make sure if you upgrade, everyone does it at the same time. Even if something goes wrong, source control lets you roll back to a working version at any time.

      FWIW I'm using GitHub with my own game project and so far it's working out great.

      • For anyone reading this reply, my workaround fixes the known "Stuck in old version" bug which annoys a lot of people around the discord at the very least (PWA c3 gets stuck to the version you install it as, and inconsistently prompts you with an update on launch which leads to members sometimes doing commits in an older version) and also lets you actually stick to a version in case some custom functionality breaks without your consent.

        Additionally those using custom engine launchers or edits were in a disadvantage as it was impossible to choose when to upgrade your team to a new version. I still lost time because of the devs not implementing a basic software QOL option before finding this workaround. The original post has everything noted.

        Your work is awesome, Ashley, but you are ignoring a lot of paying customers by not even adding an advanced option like a Chrome parameter for disabling the enforced updates which have consistently broken workflows.

          • [-] [+]
          • 2
          • Ashley's avatar
          • Ashley
          • Construct Team Founder
          • 2 points
          • *
          • (1 child)

          Updates are not mandatory - you can choose whichever release you want to use on the releases page. If you work in a team, your whole team need to upgrade at the same time. That's a part of project management that your team will need to handle - software can't handle that for you.

          If you install the stable version, then the installed version will always update to the latest stable release, and if you install a beta version, then the installed version will always update to the latest beta release. That should always work consistently, and if it doesn't, please file an issue.

          • If anyone wants to work consistently and freely using Github, currently the PWA is not the way to go. Shortcutting an editor version works exactly as it was before you enforced updates, and has never given me any issues since. I just click c3 on my taskbar, and the correct version is displayed for everyone.

            If anyone wants extra steps and the risk of losing progress, that's cool. Tried reasoning on the forums a long time ago, to everyone's frustration on the dev's responses. I still respect his stance, and his work is absolutely incredible (has been my main professional engine for too long to remember).

  • Load more comments (6 replies)