Open-source News

Delete the local reference to a remote branch in Git

opensource.com - Fri, 08/05/2022 - 15:00
Delete the local reference to a remote branch in Git Agil Antony Fri, 08/05/2022 - 03:00 Register or Login to like Register or Login to like

After you merge a GitLab or GitHub pull request, you usually delete the topic branch in the remote repository to maintain repository hygiene. However, this action deletes the topic branch only in the remote repository. Your local Git repository also benefits from routine cleanup.

To synchronize the information in your local repository with the remote repository, you can execute the git prune command to delete the local reference to a remote branch in your local repository.

More on Git What is Git? Git cheat sheet Markdown cheat sheet New Git articles

Follow these three simple steps:

1. Checkout the central branch of your repository (such as main or master) $ git checkout <central_branch_name>2. List all the remote and local branches $ git branch -a

Example output:

  4.10.z
* master
  remotes/mydata/4.9-stage
  remotes/mydata/4.9.z
  remotes/mydata/test-branch

In this example, test-branch is the name of the topic branch that you deleted in the remote repository.

3. Delete the local reference to the remote branch

First, list all the branches that you can delete or prune on your local repository:

$ git remote prune origin --dry-run

Example output:

Pruning origin
URL: git@example.com:myorg/mydata-4.10.git
* [would prune] origin/test-branch

Next, prune the local reference to the remote branch:

$ git remote prune origin

Example output:

Pruning origin
URL: git@example.com:myorg/mydata-4.10.git
* [pruned] origin/test-branch

That's it!

Maintaining your Git repository

Keeping your Git repository tidy may not seem urgent at first, but the more a repository grows, the more important it becomes to prune unnecessary data. Don't slow yourself down by forcing yourself to sift through data you no longer need.

Regularly deleting local references to remote branches is a good practice for maintaining a usable Git repository.

Follow a few simple steps to keep your Git repository tidy.

Image by:

Opensource.com

Git What to read next This work is licensed under a Creative Commons Attribution-Share Alike 4.0 International License. Register or Login to post a comment.

10 Things to Do After Installing Linux Mint 21

Tecmint - Fri, 08/05/2022 - 12:53
The post 10 Things to Do After Installing Linux Mint 21 first appeared on Tecmint: Linux Howtos, Tutorials & Guides .

This guide explains 10 things that you should do after installing Linux Mint 21, Vanessa. This focuses on the Cinnamon edition but should work for those who have installed the Mate and XFCE editions

The post 10 Things to Do After Installing Linux Mint 21 first appeared on Tecmint: Linux Howtos, Tutorials & Guides.

Transforming into next generation businesses: lessons from APAC service providers

Red Hat News - Fri, 08/05/2022 - 12:00

Internal and external pressures in the last decade have pushed service providers to begin transforming their processes and adopt technology company, or "techco", characteristics. Agile organizational structures and processes that leverage software are some initiatives companies have embarked on. Other approaches include flexible workforce, and ecosystem partnerships to create new and exciting services for customers. A report based on this research, "Transitioning to techco in APAC: priorities for success" has been written by STL Partners in conjunction with Red Hat and Intel.

Intel Raptor Lake Thunderbolt, CL1 Low-Power State Coming With Linux 6.0

Phoronix - Fri, 08/05/2022 - 07:31
Greg Kroah-Hartman has submitted all of the USB and Thunderbolt driver changes targeting the Linux 6.0 kernel of which there is a lot of new hardware enablement and enhancements to existing driver support...

Linux 6.0 KVM Brings Intel IPI Virtualization, AMD x2AVIC

Phoronix - Fri, 08/05/2022 - 02:47
There are a few notable changes worth mentioning when it comes to KVM virtualization with Linux 6.0...

Pages