Power Apps and Git version control
One of the annoying features of Canvas Power Apps is that only one user can open the app in edit mode. I don’t often want to edit an app at the same time as another maker. However, quite often I would like to check some detail about a solution when it is being edited by someone else.
Another annoying feature is that the entire contents of a Power App can not be accessed anywhere in plain code. This would speed up for example, renaming variables, changing the font throughout the application, or figuring out where variables are being used.
Of course, for almost a year now, we have been able to unpack Canvas Power Apps as code and take them to version control. But it has been more or less manual work. Not many makers have actively used this feature.
But now this is all changing. Canvas Power Apps can be connected to version control (almost) at the touch of a button. All changes are automatically saved there too with each save. And the same app can be edited by multiple makers at once!
Amazing. Let’s see how this works.
Version Control – Git (GitHub)
Git works as the version control. In the example, I will use GitHub. Of course, you can use Azure DevOps for example.
I have created a new repository for the application (MySecondPowerAppsInGitHub).
The connection between version control and Power Apps is established using a personal access token. Not with a Git username and password.
Create a new token in the Personal access tokens section under Settings > Developer settings.
Now we have a place for our application on GitHub.
Connecting to Git
Let’s create a new Power App and go to its settings. Git version control can be found in the experimental features.
When we turn on the feature, a new section will appear in the menu: Git version control.
Let’s use the Connect button to establish a connection to version control, and then enter the following information
- Git Repository URL : The address of the repository
- Branch : The name of the branch to use
- Directory : The directory to use
The repository provided must exist. The branch and directory are created if they are not found.
Finally, let’s log in. Note! The personal access token created in Git is used as the password.
Power Apps does not store your Git password. You should save the token in a password manager (or in your browser’s memory). Otherwise, you will be creating a new token every time you open Power Apps for editing…
Now the connection is established.
At the same time, the missing main branch and MyApp directory were created in Git.
Making changes (Power Apps)
Let’s add a few controls to the app.
And also save and add a comment (Version notes).
Saved changes will be visible in Git immediately. Likewise the comment added during the save.
And I didn’t make any Git commands from the command line. I don’t even have to know what they are.
Changes made by others
When saving, Power Apps studio checks to see if anyone else has edited the app. The changes will appear automatically.
In the image below you can see a new label “Added by BigBoss” that was added by another user.
We can also commit the changes with the sync button at the top right.
Now the changes I made have been confirmed.
Based on brief testing and reading of the documentation, it’s a little unclear what the difference between saving and syncing ultimately is. Both end up committing the changes.
"Each save or synchronize that includes changes will result in a commit in Git."
Also, after both actions, changes made by others will appear in the editor.
Simultaneous editing
Simultaneous editing of Power Apps works surprisingly well. Even the same control can be edited at the same time. However, if users edit the same property (e.g., height) of the same control, the last edit remains in effect.
It is not possible to resolve possible conflicts between changes by yourself. Power Apps studio does it for you, and it may not always work. If the outcome is not satisfactory, things can be corrected from Git. Any changes made to the App will be saved there.
Editing in version control
In GitHub, let’s go to the screen 1 code, and rename the controls btnButton and inpSearch. Finally, let’s commit with the appropriate comment.
After this, let’s sync the Power Apps. Yes, the names of the controls have been changed!
Summary
The Git integration of Canvas Power Apps is only an experimental feature. I do not recommend using it yet in production applications. However, it still works surprisingly well.
As a feature, this is exactly what I have been longing for. An easy way to get apps to GitHub, making it easier to make certain types of changes and troubleshoot problems.
As an additional bonus, we also get the simultaneous editing of applications.
Next on my wish list is an equally simple implementation for publishing an application from Git to a desired Power Platform environment. Then I would be happy. For a moment.
Working together seems hazardous to me as a control with same name created at the same time by two Devs will be replaced by the last Dev who sync his work without any warning !
A great way to lose code without be aware of it.
Yes. I hope this will change soon. Have to keep in mind that this is still an experimental feature.
Thank you for the insight of this new feature. Tried it at work today and was surprised how well it works. This makes editing an app in VSC even easier. Hope they‘ll continue improving this feature.
Could this also work on our local Bonobo Git Server?
I’ve tried but get an invalid username or password error but the used credentials are correct.
Hi!
I assume that this is working only with GitHub and DevOps currently.
Does this work well with Gitlab instead of GitHub?
According to Microsoft Docs, “any Git provider can be used with Power Apps Studio”. While we haven’t tested GitLab, at least in theory it should work with this experimental source code version control feature. There shouldn’t be intentional dependencies to Microsoft owned services like GitHub or Azure DevOps.
How does this affect including the Power App in a solution and using the Power Platform Tools in an ADO pipeline that saves the solution to an ADO Git repo? Would it save to both? This seems like a necessary feature, but the Power Platform Tools for ADO uses Solutions. Also, the Pipeline that saves to the Repo doesn’t has to be manually triggered. I don’t see this as being a viable solution for anything outside of a standalone Power App.
Hi!
This is still an experimental feature, so let’s see how this evolves. This is more like real-time sync to the git and only for the canvas app source code. So if you have automated pipelines, this might be overlapping with that.
Pretty nice for citizen developers (after someone has made the connection for them) or consultants building canvas apps. But for the team that has pipelines already in place? Not yet.
Very helpful
Thank you for your post. Very helpful!
“Power Apps does not store your Git password. You should save the token in a password manager (or in your browser’s memory).”
Is there an alternative to this? Like a way to get devops to remember my identity or trust this power app?
Hi!
Git integration is still an experimental feature. Let’s see if there are more options when this came on the preview. Currently, you can use only browser features to store the token. Unfortunately.
https://learn.microsoft.com/en-us/power-apps/maker/canvas-apps/git-version-control#known-limitations