git常见命令(成长版)

ps:所谓成长版就是后续可能还会添加命令:

1.删除本地分支:

复制代码
git branch -d 分支名

2.拉取代码后默认master分支,切换到线上其他分支:

(1)查看线上所有分支:

复制代码
git branch -a

(2)本地切换到线上指定分支:

复制代码
// 以从master切换到develop为例
git checkout -b develop origin/develop

3.创建本地分支:

可通过下面命令创建本地分支。

复制代码
git branch

比如以master为准创建一个新分支:

首先应确保处于该分支下,不是的话通过checkout切换:

复制代码
git checkout 分支名

创建即可:

复制代码
git branch 分支名

4.首次提交本地新分支:

可能会出现类似下述报错

复制代码
There is no tracking information for the current branch.
Please specify which branch you want to merge with.
......

解决方案:

复制代码
git push -u origin 本地新分支名

待补充中。。。

希望本文会对您有所帮助~ ^_^

相关推荐
Ws_10 小时前
Git + Gerrit 第二课:diff、暂存区与撤销修改
git
snowjlz10 小时前
鸿蒙版SVN来了!!!
git·svn·版本控制
2401_8769641312 小时前
27考研余炳森概率论|喻老李良2027资料网课
windows·git·考研·svn·eclipse·github·概率论
爱搬砖的狮子13 小时前
【Git】git repo下载使用
git
cheems952716 小时前
Git基本操作
git
Irissgwe16 小时前
三、Git 文件状态管理:add、commit、status 和 diff
git
Ws_21 小时前
Git + Gerrit 第三课:分支、切换与合并
git·elasticsearch
xlq2232221 小时前
6.git
git
Drache_long1 天前
Git命令概述
git
console.log('npc')1 天前
修改git中commit内容
git