首页 中国创投网 > 金融 > 正文

TortoiseGit使用Cherry Pick遇到的问题及解决方案-环球观察


(资料图)

TortoiseGit的Cherry Pick

比如从master pick某一个commit 记录到其它分支(release)

pick的操作方法:切到分支,点击 show log,然后在log dialog的左上角切到master,选中需要的commit记录,再右键选择cherry pick

pick的流程:switch branche ,fetch &rebase , pick , push

cherry pick之后无法push

pick完成之后,需要push到远端,但是push的时候提示需要更新,尝试过多次的fetch&rebase,依然是这个提示。这就有些不解了,到底问题出在那儿?

hint: Updates were rejected because the remote contains work that you dohint: not have locally. This is usually caused by another repository pushinghint: to the same ref. You may want to first integrate the remote changeshint: (e.g., "git pull ...") before pushing again.hint: See the "Note about fast-forwards" in "git push --help" for details.
cherry pick检查本地文件已修改

因为在push的界面,提示本地无修改,那么查看下本地文件是否有修改?

查看本地文件已修改,并且log中也有master的log。

试试rebase

同样是在show log的窗口中,通过rebase hard完全重置,再重来一次,发现还是not work。

再试试切换分支

切换分支的log中可以看到本地是有pick过来的修改,但是无奈push的时候没有内容

git.exe checkout remotes/origin/release --Warning: you are leaving 1 commit behind, not connected toany of your branches:548ce392db xxx commit log messageIf you want to keep it by creating a new branch, this may be a good timeto do so with:git branch  548ce392dbHEAD is now at af32dedb76 xxx commit log messageSuccess (437 ms @ 2023/6/26 14:15:26)
原因:本地分支坏了

切换分支时,分支要从remote中选,而不是从上面选(本地),选完之后,再来一次fetch&rebase,就ok了。

建议勾选 overrider branch和track。

关键词:

关于本站 管理团队 版权申明 网站地图 联系合作 招聘信息

Copyright © 2005-2023 中国创投网 - cn.xunjk.com All rights reserved
联系我们:39 60 29 14 2@qq.com
皖ICP备2022009963号-3