【问题标题】:Powerapps solution failing to commit latest changes to dev via gitPowerapps 解决方案无法通过 git 向开发人员提交最新更改
【发布时间】:2021-07-29 03:30:45
【问题描述】:

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

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

【问题讨论】:

    标签: git azure-devops powerapps power-platform


    【解决方案1】:

    Powerapps 解决方案无法通过 git 向 dev 提交最新更改

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

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

    git checkout -f branch
    

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

    查看当前分析,如master:

    git branch
    

    提交修改代码:

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

    切换分支:

    git chechout xxx
    

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

    git stash
    

    查看similar thread 了解更多详情。

    【讨论】:

    • 谢谢。我一定会试一试的。
    猜你喜欢
    • 2017-04-21
    • 2012-12-22
    • 2021-12-30
    • 1970-01-01
    • 2011-07-08
    • 1970-01-01
    • 2019-10-19
    • 2015-07-10
    • 1970-01-01
    相关资源
    最近更新 更多