是否有git“git pull

编程入门 行业动态 更新时间:2024-10-27 23:19:09
是否有git“git pull --dry-run”选项?(Is there a “git pull --dry-run” option in Git?)

有没有像git pull --dry-run这样的东西,看看它会混合在我的工作树之前如何合并?

现在我在做:

git fetch origin && git merge --no-commit --no-ff

我在手册页没有看到与git-pull有关的任何内容。

编辑:

为了弄清楚,我只需要在ant脚本中进行部署来查看在执行git pull时是否存在冲突,然后退出退出构建,失败部署,并将该dir树与git pull之前相同。

Is there such a thing as git pull --dry-run to see how stuff will be merged before it messes up my working tree?

Right now I am doing:

git fetch origin && git merge --no-commit --no-ff

I did not see anything in the man page for 'git-pull' related to it.

To clarify, I just need it in an Ant script for deployment to see if there are conflicts when doing git pull, then back off exit out of build, fail deployment and leave that directory tree the same it was before git pull.

最满意答案

如果合并失败,我一直依靠git的固有能力让我回来。

要估计合并可能发生的情况,您可以像以前一样开始:

$ git fetch origin branch # fetch changes but don't merge $ git diff HEAD..origin/branch # diff your current head to the fetched commit ... personal judgement of potential merge conflicts ... $ git merge origin/branch # merge with the fetched commit

如果事情没有按计划进行,请查看您的reflog并重新设置为您所需的状态

$ git reflog ... abc987 HEAD@{0}: merge activity b58aae8 HEAD@{1}: fetch origin/branch 8f3a362 HEAD@{2}: activity before the fetch ... $ git reset --hard HEAD{2}

I have always relied on the inherent abilities of Git to get me back if a merge fails.

To estimate how the merge might occur, you can start like you did with:

$ git fetch origin branch # Fetch changes, but don't merge $ git diff HEAD..origin/branch # Diff your current head to the fetched commit ... personal judgement of potential merge conflicts ... $ git merge origin/branch # merge with the fetched commit

If things did not go as planned, look at your reflog and reset back to your desired state:

$ git reflog ... abc987 HEAD@{0}: merge activity b58aae8 HEAD@{1}: fetch origin/branch 8f3a362 HEAD@{2}: activity before the fetch ... $ git reset --hard HEAD{2}

更多推荐

本文发布于:2023-04-27 21:01:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1328605.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:git   pull

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!