0

Running into issues with AzureDevOp pipelines for PowerApps Solution. Initially was able to add solution files to source control without any problem and then created a dev branch from it to keep committing changes to the dev branch.

This is code being used to add solution to source control :

echo commit all changes
git config user.email "EMAIL@EMAIL"
git config user.name "Automatic Build"
git checkout DevBranch
git add --all
git commit -m "Committing all changes"
echo push code to new repo
git -c http.extraheader="AUTHORIZATION: bearer $(System.AccessToken)" push origin DevBranch

Now this is failing with exit code 1 and I cant really understand why. The git code error says:

commit all changes
error: Your local changes to the following files would be overwritten by checkout:
    XXX_8cec2.meta.xml
    XXX_8cec2_DocumentUri.msapp
Please commit your changes or stash them before you switch branches.
Aborting
hint: Pulling without specifying how to reconcile divergent branches is
hint: discouraged. You can squelch this message by running one of the following
hint: commands sometime before your next pull:
hint:
hint: git config pull.rebase false # merge (the default strategy)
hint: git config pull.rebase true # rebase
hint: git config pull.ff only # fast-forward only
hint:
hint: You can replace "git config" with "git config --global" to set a default
hint: preference for all repositories. You can also pass --rebase, --no-rebase,
hint: or --ff-only on the command line to override the configured default per
hint: invocation.
You are not currently on a branch.
Please specify which branch you want to merge with.
See git-pull(1) for details.

git pull <remote> <branch>

[detached HEAD 0425626] Updating branch code for powerapps
2 files changed, 3 insertions(+), 3 deletions(-)
push dev code to repo
! [rejected] Dev -> Dev (non-fast-forward)
error: failed to push some refs to 'https://LINK
hint: Updates were rejected because a pushed branch tip is behind its remote
hint: counterpart. Check out this branch and integrate the remote changes
hint: (e.g. 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
##[error]Cmd.exe exited with code '1'.
##[section]Finishing: Push to Repo

Any suggestion/help is highly appreciated. Thanks

Sanjay
  • 289
  • 2
  • 5
  • 14

1 Answers1

0

Powerapps solution failing to commit latest changes to dev via git

According to the error message, it seems the locally modified code will be overwritten by the code on git by switching branches.

To resolve this issue, pass the -f (force) flag to forcefully checkout the branch, this will wipe out any changes you've made that haven't been committed:

git checkout -f branch

Or you could try to overwrite the local by submitting the change file:

View current analysis, such as master:

git branch

Submit modified code:

git add .
git commit -m “add all”
git push origin master

Switch branch:

git chechout xxx

And if you don’t want to submit, you can also use git stash to save the current workspace content in the git stack:

git stash

Check the similar thread for some more details.

Leo Liu
  • 71,098
  • 10
  • 114
  • 135