TortoiseGit使用Cherry Pick遇到的问题及解决方案

本文为作者原创,转载请注明出处:https://www.cnblogs.com/zhaoqingqing/p/17507418.html


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,依然是这个提示。这就有些不解了,到底问题出在那儿?

Copy
hint: Updates were rejected because the remote contains work that you do hint: not have locally. This is usually caused by another repository pushing hint: to the same ref. You may want to first 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.

cherry pick检查本地文件已修改#

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

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

image-20230626141843574

试试rebase#

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

再试试切换分支#

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

Copy
git.exe checkout remotes/origin/release -- Warning: you are leaving 1 commit behind, not connected to any of your branches: 548ce392db xxx commit log message If you want to keep it by creating a new branch, this may be a good time to do so with: git branch <new-branch-name> 548ce392db HEAD is now at af32dedb76 xxx commit log message Success (437 ms @ 2023/6/26 14:15:26)

原因:本地分支坏了#

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

建议勾选 overrider branch和track。

image-20230626151114001

© 版权声明
THE END
喜欢就支持一下吧
点赞0

Warning: mysqli_query(): (HY000/3): Error writing file '/tmp/MYsASjpf' (Errcode: 28 - No space left on device) in /www/wwwroot/583.cn/wp-includes/class-wpdb.php on line 2345
admin的头像-五八三
评论 抢沙发
头像
欢迎您留下宝贵的见解!
提交
头像

昵称

图形验证码
取消
昵称代码图片