We will learn to configure the Co-authoring & Git version control in Canvas App. Before we start, make sure to subscribe to CRM Crate so that you can stay up to date in the field of Power Apps.
What is Git Hub?
GitHub is a code hosting platform for collaboration and version control. It empowers you to work together on projects along with the team. At a high level, GitHub is a portal and cloud-based service that helps makers & developers to store and manage their code, as well as track and control changes to their code.
Below are the essential components of Github:
- Pull Requests
What is a Repository?
What is a Branch?
A GitHub branch is used to operate with different versions of a repository at the same time or simultaneously. A repository has a master branch by default and any other new is branch is set as a copy of the master branch.
New Branches are for custom processes such as defect fixes and features which need to work separately from the master branch. When changes are ready, they can be merged into the master branch. If you make changes to the master branch while working on a new branch, these updates can be pulled in.
What are Commits?
Changes or modifications are called as “Commit” in Github.
Each commit or change has a description stating why a change was made by a particular developer.
What are Pull Requests?
Pull Requests are considered as heart of GitHub collaboration. With a pull request you are stating that your changes or modifications should be merged /pulled in with the master.
Pull requests display the content differences, changes, additions, and subtractions in colors (green and red). As soon as you have a commit, you can initiate a pull request and start a discussion, even before the code is finished.
What is Co-authoring in canvas apps?
We can now use the Git version control to enable more than one maker or developer to customize a canvas app at the same time. With this feature, others won’t get locked out of the app while one person is editing it.
As modifications are made and synchronized, they’re automatically merged with other live changes, and made available to all other makers / developers who are editing the app. The GitHub is used as the backing store for this feature.
How to enable Git version control in Canvas App?
Follow the below steps to enable Git version control.
- Open Power Apps Studio (https://make.powerapps.com/).
- Access your Canvas App and click on Settings in Power Apps Studio.
- Navigate to the feature “Show the Git version control setting” and enable it.
- Now you’ll see a new Git version control item on the left-hand side of the settings pane as shown below.
Connect your Canvas App to Github
Follow the given steps to connect your Canvas App to Git.
- In App setting, navigate to Git version control.
- Select Connect, and fill-in Git connection information for this app.
Significance of Repository URL, Branch & Directory nameGit Repository URL: The URL you would normally use with Git tools. For Azure DevOps, be sure to include the /_git/repo portion of the URL, such as
Branch: The branch name to use.
Directory: The directory within the branch to use. You can’t store a canvas app at the root of the branch.
- Once done, you need to authenticate the Git with an access token.
- Open your GitHub, navigate to Settings >> Developer Settings >> Personal Access Token to get the access token.
- Note: – While editing apps connected to Git, you’re prompted for username and password. Enter your username and the access token in this dialog to authenticate with Git as shown below.
Validate the Git Version Control by making changes in Canvas App
- Once your Canvas App is connected to Git, all you have to do is authenticate with Git credentials to open and edit the app.
- Use the new synchronize button at the top of the Studio screen to merge any current changes with what’s in Git, and to bring the result into Studio for further editing as shown below.
- After being connected to Git, changes and customizations are stored in Git rather than in Power Apps. Unpublished versions won’t appear in the Power Apps maker portal.
- In the below demonstration, we have used two different users named “Prashant Tirlotkar” and “Omkar Rane”. Changes done by these users are automatically stored in the Git Repository.
Limitations of Git Version Control
There are few known limitations as given below since the feature is yet experimental.
- You can’t restore a canvas app to a previous version using the steps described in Restore an app article. Instead, you’ll have to use Git for restoring the app to a previous version.
- Connecting multiple apps to the same git directory may cause problems. This includes making copies of your app and exporting and importing them.
- If you see a message about the app being open for editing by another user, ask the referenced user to refresh the app. Afterwards, refresh your app to remove the lock.
- This feature does not support renaming of custom components.
- Any existing files in the repository with names exceeding 180 characters in length may cause problems when connecting. We recommend using a dedicated repository for Git connected apps.
- This feature isn’t compatible with code components. Don’t use this feature with apps that make of use of code components.
- This feature isn’t compatible with on-premises Git repositories. The Git repo must be hosted on the web and accessible with username and personal access token.
- Edits to the same property on the same control aren’t merged. The last edit made will win.