RUVIDEO
Поделитесь видео 🙏

Automatically delete branches from git repository using terminal

On this video I will explain you how you can easily erase your git branches on an automated way
using a very useful set of commands from your Linux or Mac terminal, so let´s go to it.

The first thing we need to do is be able to get the list of branches currently available on our local repository.
For this you can do the "git branch -l" command. This will list us the branches available. You will see that we have set up
4 branches on our test repository.

From here we will introduce the power of the terminal using a pipeline, we will pipe the list of branches to the grep command which is very useful
to match patterns in general and for this case we will use the -v option wich stands for "Invert match", along with this option we will be using the -e
option, this will enable the ability to use a regular expression, In this case I will be using a regular expression to skip the master and the dev branch since I am using the "invert" option so now on the new list I only see 2 branches, so now I only need to find a way to use them as a source to delete them which is what I really need. In order to delete them we need to pass them as arguments to the delete command in git, for this we can use the xargs command, xargs allows you to use a list coming from a pipe to be passed to the next command.

So along with the xargs command you can proceed with the "git branch -d" , this command what it does is deleting the branches that has been merge from your local repository, If we execute this we will see that we deleted the branches. Just as the "-d" we have the uppercase "-D" that deletes also the branches that are not merge yet too. So with this combination you can actually get new ways to clean your git repository.

If you want to learn more about git and the terminal please see the description for recommendations on really good books about this topics and more.
I hope you liked the video and saved some time, don´t forget to hit the like button and subscribe. Happy coding and have a good day.

Что делает видео по-настоящему запоминающимся? Наверное, та самая атмосфера, которая заставляет забыть о времени. Когда вы заходите на RUVIDEO, чтобы посмотреть онлайн «Automatically delete branches from git repository using terminal», вы рассчитываете на нечто большее, чем просто загрузку плеера. И мы это понимаем. Контент такого уровня заслуживает того, чтобы его смотрели в HD 1080, без дрожания картинки и бесконечного буферизации.

Честно говоря, Rutube сегодня — это кладезь уникальных находок, которые часто теряются в общем шуме. Мы же вытаскиваем на поверхность самое интересное. Будь то динамичный экшн, глубокий разбор темы от любимого автора или просто уютное видео для настроения — всё это доступно здесь бесплатно и без лишних формальностей. Никаких «заполните анкету, чтобы продолжить». Только вы, ваш экран и качественный поток.

Если вас зацепило это видео, не забудьте взглянуть на похожие материалы в блоке справа. Мы откалибровали наши алгоритмы так, чтобы они подбирали контент не просто «по тегам», а по настроению и смыслу. Ведь в конечном итоге, онлайн-кинотеатр — это не склад файлов, а место, где каждый вечер можно найти свою историю. Приятного вам отдыха на RUVIDEO!

Видео взято из открытых источников Rutube. Если вы правообладатель, обратитесь к первоисточнику.