0

PowerApps 解决方案的 AzureDevOp 管道遇到问题。最初能够毫无问题地将解决方案文件添加到源代码控制,然后从中创建一个开发分支以继续提交对开发分支的更改。

这是用于向源代码管理添加解决方案的代码:

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

现在退出代码 1 失败了,我真的不明白为什么。git代码错误说:

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

非常感谢任何建议/帮助。谢谢

4

1 回答 1

0

Powerapps 解决方案无法通过 git 向开发人员提交最新更改

根据错误信息,似乎本地修改的代码将通过切换分支被git上的代码覆盖。

要解决此问题,请传递-f (force)标志以强制签出分支,这将清除您所做的任何尚未提交的更改:

git checkout -f branch

或者您可以尝试通过提交更改文件来覆盖本地:

查看当前分析,如master:

git branch

提交修改代码:</p>

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

切换分支:

git chechout xxx

而如果不想提交,也可以使用 git stash 将当前工作区内容保存在 git 栈中:

git stash

检查类似的线程以获取更多详细信息。

于 2021-05-07T07:07:38.120 回答