1、解决的问题描述
开发模式是master 分支、develop分支,master是最终版本的分支。在master上不小心删除了一个文件index.html,然后想通过合并develop分支找回文件但是怎么merge都没有过来,后来找git命令找回
2、解决问题的方法
(1)找到index.html在develop分支上的路径
(2)git checkout develop -- "/path/index.html"
这样就能够合并过来了,不然通过 merge是不会合并过来的
3、token 使用
1.配置可信任文件
.my-credentials 文件内容
https://gitlab%2bdeploy-token-36:xadsasdasdasdasdasdF@gitlab.xxx.cn
2.git项目目录下执行
git config credential.helper 'store --file .git/.my-credentials'
备注:
git config credential.helper store会默认使用 ~/.git-credentials 文件;这种情况相当于全局配置,针对与一种一台主机上只有一个项目可用,如果多个项目会冲突;