git分支

时间:2022-07-22
本文章向大家介绍git分支,主要内容包括其使用实例、应用技巧、基本知识点总结和需要注意事项,具有一定的参考价值,需要的朋友可以参考一下。

背景:

开发了一个网站,为实现某个需求,新建一个分支,并在上面完成

1、新建分支

<code>git branch t1</code>

2、切换分支

<code>git checkout t1</code>








<code># git checkout t1</code>



A       cf



D       chenfei



M       test.sh



Switched to branch &#8216;t1&#8217;








<code># git branch</code>



  master



<span style="color: #ff4635;">* t1</span>



  t2

3、新建并切换分支

<code>git checkout -b t1</code>

4、查看所有的分支

<code>git branch</code>

5、查看各个分支最后一个提交对象的信息

<code>git branch -v</code>

6、查看未提交的分支有哪些

<code>git branch --merged</code>

7、查看哪些分支已经并到当前分支

<code>git branch --no-merged</code>

8、删除分支

<code>git branch -d t1</code>