bash 脚本获取当前 git 所有本地分支

  1. 新建 local-bracnes.sh 文件

sh 文件内,输入以下内容

bash 复制代码
#!bin/bash

branches=$(git branch --no-merged master)

for branch in $branches; do
  echo "\033[31m \$current branch:\033[0m $branch"
done
  1. 执行 sh 文件
bash 复制代码
$ sh local-branches.sh
相关推荐
夜夜敲码8 分钟前
C语言教程(十六): C 语言字符串详解
c语言·开发语言
宋康15 分钟前
C语言结构体和union内存对齐
c语言·开发语言
居然是阿宋25 分钟前
Kotlin高阶函数 vs Lambda表达式:关键区别与协作关系
android·开发语言·kotlin
李菠菜30 分钟前
解决Windows系统下Git克隆时报错“unable to checkout working tree”的方法详解
windows·git
island131438 分钟前
【git#4】分支管理 -- 知识补充
大数据·git·elasticsearch
Cao1234567893211 小时前
简易学生成绩管理系统(C语言)
c语言·开发语言
The Future is mine1 小时前
C# new Bitmap(32043, 32043, PixelFormat.Format32bppArgb)报错:参数无效,如何将图像分块化处理?
开发语言·c#
亿坊电商1 小时前
PHP框架在微服务迁移中能发挥什么作用?
开发语言·微服务·php
烁3471 小时前
每日一题(小白)模拟娱乐篇33
java·开发语言·算法
坐吃山猪1 小时前
Python-Agent调用多个Server-FastAPI版本
开发语言·python·fastapi