有没有一个“git pull -dry-run” Git中的选项? [英] Is there a "git pull --dry-run" option in Git?
问题描述
$ b
现在我正在做:
git fetch origin&& git merge --no-commit --no-ff
我在手册页中没有看到任何东西'b
$ b
为了澄清,我只是需要它在Ant脚本中进行部署,以查看在执行<$ c $时是否存在冲突c> git pull ,然后退出构建,失败部署,并保持该目录树与之前的相同 git pull
。 p>
我一直依靠Git的内在能力让我回到合并失败的状态。
为了估计合并的可能性,您可以像开始一样:
$ git fetch起源分支#获取更改,但不要合并
$ git diff HEAD..origin / branch#将当前头部延伸到提取的提交
...个人判断潜在合并冲突...
$ git merge origin / branch#合并提取的提交
<如果事情没有像PL那样发展anned,看看你的 reflog
,然后重置回你想要的状态:
$ git reflog
...
abc987 HEAD @ {0}:合并活动
b58aae8 HEAD @ {1}:获取原点/分支
8f3a362 HEAD @ {2}:在获取
之前的活动...
$ git reset --hard HEAD {2}
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
.
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}
这篇关于有没有一个“git pull -dry-run” Git中的选项?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!