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 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!
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.
Interested in reading our latest Power Platform blog posts?
You’re welcome to subscribe to our email newsletter: Forward Forever News. Max 1 email per month, with a curated list of latest insights and articles on Power Apps, Power Automate, Power BI.
Canvas app source code editing with VS Code in your browser - Jukka Niiranen2022-01-10 at 12:02
[…] The experimental feature for connecting Power Apps Canvas apps with Git version control is pretty amazing. You can read this blog post from my FF colleague Timo Pertilä to see how it looks like for app makers: Power Apps and Git version control. […]
alexsolex2022-01-11 at 08:44
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.
Team Forward Forever2022-01-11 at 08:56
Yes. I hope this will change soon. Have to keep in mind that this is still an experimental feature.
Reiner Knudsen2022-01-11 at 19:36
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.
Power Apps, GitHub and Visual Studio Code - Forward Forever2022-01-24 at 12:25
[…] the previous post, we reviewed the new (experimental) feature in Canvas Power Apps that makes it easy to integrate […]
Paul Wouterse2022-03-24 at 16:42
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.
Team Forward Forever2022-03-25 at 08:50
I assume that this is working only with GitHub and DevOps currently.
Meena2022-03-29 at 19:52
Does this work well with Gitlab instead of GitHub?
Team Forward Forever2022-03-31 at 10:41
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.
PB2022-05-09 at 19:54
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.
Timo Pertilä2022-05-10 at 08:56
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.
Jack S Winslow2022-06-29 at 13:05
Nuchem2022-09-26 at 12:19
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?
Team Forward Forever2022-09-29 at 18:57
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.