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 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。
试试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 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。
热门相关:倾心之恋:总裁的妻子 道君 前任无双 花月颂 民国之文豪崛起