开发过程中经常用到从master分支copy一个开发分支,下面我们就用命令行完成这个操作: 1. 切换到被copy的分支(master),并且从远端拉取最新版本 $git checkout master $git pull 2. 从当前分支拉copy开发分支 $git checkout -b dev Switched to a new branch 'dev' 3. 把新建的分支push到远端$git push origin dev 4. 拉取远端分支$git pull There is no
git pull时出现分支冲突(branch diverged) $ git status # On branch feature/worker-interface # Your branch and 'origin/br_dev' have diverged, # and have 1 and 4 different commit(s) each, respectively. 解决办法:1.查看哪个commit冲突git cherry origin/br_dev 2.回退到冲突的前一个comm
场景:需要回退至红框中的那个版本,并且只添加“缓存逻辑优化,增加加载中的状态”这一次commit,其他的commit不添加. 步骤: 1) 切换到指定分支 dev git checkout dev 2) 回退至指定版本 git reset --hard 6fd1e9a70a70f381d060f83d4d4d5dc113ccae35 3) 创建新分支 test git branch test git checkout test 4) 添加 “缓存逻辑优化,增加加载中的状态” 这次commit g
执行git pull或者git push的时,有时候会出现如下报错: $ git pull You asked me to pull without telling me which branch you want to merge with, and 'branch.linux_c++.merge' in your configuration file does not tell me, either. Please specify which branch you want to use o