草庐IT

git branch命令解析

一、序言        branch分支是指在开发主线中分离出来的,做进一步开发而不影响到原来的主线。    gitbranch命令是对于项目分支的一些操作,不同参数代表不同的操作,主要有查看分支、创建分支、删除分支、分支重命名的功能。二、查看分支gitbranch//列出"本地"已经存在的分支,当前分支会用*标记gitbranch-r//查看"远程"仓库的分支列表gitbranch-a//查看所有分支列表(包含"本地和远程"分支)gitbranch-vv//查看"本地分支对应的远程分支"(包含最新一次提交的信息)gitbranch-v//查看一个分支的最新一次提交gitbranch--mer

git常见问题 — git pull时提示 git pull <remote> <branch>

问题描述gitpull的时候提示gitpull$gitpullUnpackingobjects:100%(7/7),1.16KiB|31.00KiB/s,done.Fromhttp://172.20.30.31:8081/code/frontend/dms-ui-corecf5da93..8793689release->origin/releaseThereisnotrackinginformationforthecurrentbranch.Pleasespecifywhichbranchyouwanttomergewith.Seegit-pull(1)fordetails.gitpullre

Git删除分支不成功,提示:error: Cannot delete branch......的问题解决

一问题来源      本地的代码仓库里面,有很多分支,随着项目的不断迭代,这样的分支变得越来越多。于是想把这样的分支给删掉,在删除分支的时候,报错:error:Cannotdeletebranch''checkedoutat'/Users/GoProject/src/code,对应的提示如下:二解决问题      首先需要说明的是,我是切换到master分支,再来删除这个分支的(也就是说,我不是在当前分支上,删除当前分支)。另外在本地删除分支,一般就是执行命令:gitbranch-D以及gitbranch-d,大多数情况下都会成功!但很奇怪的是,这次居然没有成功。      经过查看该分支的状

git push错误:You are not allowed to force push code to a protected branch on this project

现象    本地使用 gitpush--forceorigin命令强制推送时,出现“Youarenotallowedtoforcepushcodetoaprotectedbranchonthisproject”错误,意为该分支为受保护的,不允许这类操作,可以通过git管理后台关闭该项目分支的保护状态处理。设置使用管理员账号进入git中的项目设计,setting>repository>protectedbranches>unprotect关闭保护。 

【Git】Git报错:Branch ‘master‘ set up to track remote branch ‘master‘ from ‘orgin‘

前言:如果遇到将从git上拉取的代码,直接上传到新的git仓库地址,注意,需要修改git源,否则,会报错。报错信息如下:Git报错:Branch‘master’setuptotrackremotebranch‘master’from‘orgin’解决方案:①移除之前的git源:gitremotermorigin②再次连接新的git源:gitremoteaddorigin'仓库地址'

GIT 错误 On branch master Your branch is up to date with ‘origin/master‘. nothing to commit, working

错误解决OnbranchmasterYourbranchisuptodatewith'origin/master'.nothingtocommit,workingtreeclean我的理解:分支被意外删除#先查看分支—应该会有一个*master—不管他gitbranch#切到master分支,提示Switchedtobranch'master'Yourbranchisuptodatewith'origin/master'.#直接切换到‘origin/master’分支#更新,推送一套走完#检测分支‘gitbranch‘,有如下提示就,按部就班*(HEADdetachedatorigin/mas

On branch masternothing to commit, working tree clean

错误问题: 解决方案:1.把需要上传的文件拖放到git生成的文件夹里即可 2.gitadd.   gitcommit-m"第二次提交"    

vscode新建、删除git branch

下载gitgraph插件,基于gitgraph的可视化操作。新建gitbranch图中dev_tmp分支是新建的临时分支。新建后通过gitgraph看到的新分支:删除gitbranch若该分支已合并完毕,需要删除dev_tmp分支,则在gitgraph页面右键该分支的tag图标,选择删除分支。要注意先切换到非删除分支上,否则在dev_tmp分支上,无法删除自身。(选中dev_tmp分支后,右键dev_tmptag是没有删除选项的)。

【git报错】The current branch dev has no upstream branch. To push the current branch and set the remote

发现问题本地新建了一个dev分支,然后把dev分支下的代码push到远程仓库中,使用gitpush,但是报错了,如下:fatal:Thecurrentbranchdevhasnoupstreambranch.Topushthecurrentbranchandsettheremoteasupstream,usegitpush--set-upstreamorigindev翻译错误:当前分支:dev没有远程对应的dev分支。要推动当前分支并将远程设置为上游,请使用。。。原因首先gitpush命令,是默认将当前分支Push到远程的对应的分支,如果远程不存在对应分支,则会报错。比如这里,本地是dev分支

git commit 出现On branch master nothing to commit, working tree clean解决方法

gitcommit返回的是Onbranchmasternothingtocommit,workingtreeclean,通过gitstatus查看是否提交返回的也是Onbranchmasternothingtocommit,workingtreeclean,但在idea的git管理上可以发现确实是提交了的:因为在idea上显示已提交,所以就尝试直接push,报错: 查看报错信息,提示需要先gitpull然后再push,gitpull后报错: 改用gitpulloriginmaster,报错: 之前遇到过这个报错,改用 gitpulloriginmaster--allow-unrelated-h