欢迎光临散文网 会员登陆 & 注册

Git提交本地代码至分支(详细每一步)

2022-04-10 11:19 作者:年轻人的时间很快  | 我要投稿

一、查看分支

A: 查看本地分支

使用 git branch命令,如下:git branch

*标识的是你当前所在的分支

 

B: 查看远程分支

命令如下:git branch -r

C: 查看所有分支

命令如下:git branch -a


二、本地创建新分支

命令如下:git branch [分支名称]

例如:git branch plateformSuperdog

 

三、切换到新分支

命令如下:git checkout [分支名称]

例如:git checkout plateformSuperdog

 

四、创建+切换分支

命令如下:git checkout -b [分支名称]

例如:git checkout -b plateform2

 

其中:git checkout -b [分支名称]相当于两步

git branch [分支名称]

git checkout [分支名称]

 

五、将新分支推送到github

命令如下:git push origin [分支名称]

 

六:删除本地分支

命令如下:git branch -d [分支名称]

 

七、删除github 远方分支

命令如下:git push origin :[branch name]

其中:分支前面:代表删除

例如:git push origin : plateform2

 

八:git 提交本地代码至新分支

1.切换到新分支

命令如下:git checkout [分支名称]

例如:git checkout plateform2

2.添加本地需要提交的代码

命令如下:git add .

3.提交本地代码

命令如下:git commit -m "修改说明"

4.push到git仓库

命令如下:git push origin [分支名称]

例如:git push origin plateform2

Git提交本地代码至分支(详细每一步)的评论 (共 条)

分享到微博请遵守国家法律