Forum Discussion

Denni1510's avatar
Denni1510
Copper Contributor
Jul 21, 2023

Branch Aliases on repositoty

Hey,
Is there any way to push branch alias to azure git repo? I mean, I have the following branch configured locally:

$ more .git/refs/heads/release_17.0
>> ref: refs/heads/master

But once I push such a reference to azure repository, it becomes a regular branch (pointing to the specific commit, rather than to another reference), so it still points to the same commit it was at the time of push, even if I merge anything to master.

  • Denni1510. When you push a branch to an Azure Git repository, it creates a regular branch that points to the specific commit at that time, rather than pointing to another branch reference.

     

    Branch aliases, also known as symbolic references or symbolic links, are a feature available in Git itself, but not all Git hosting services support them. They allow you to create references that point to other references, such as having a branch alias that always points to the latest commit of another branch.

    Unfortunately, without native support for branch aliases in Azure Repos, you won't be able to have the behavior you described, where a branch alias always points to the latest commit of the master branch. Instead, you would need to update the branch reference manually to point to the latest commit whenever you want it to reflect the changes from the master branch.

     

    If branch aliases are critical to your workflow, you might consider using a different Git hosting service that supports this feature, or you could explore using Git hooks or automation to manage the branch reference updates in your Azure Repos repository. However, keep in mind that this would require custom scripting and might not be as seamless as native branch alias support.

  • ProSolutions's avatar
    ProSolutions
    Iron Contributor

    Denni1510. When you push a branch to an Azure Git repository, it creates a regular branch that points to the specific commit at that time, rather than pointing to another branch reference.

     

    Branch aliases, also known as symbolic references or symbolic links, are a feature available in Git itself, but not all Git hosting services support them. They allow you to create references that point to other references, such as having a branch alias that always points to the latest commit of another branch.

    Unfortunately, without native support for branch aliases in Azure Repos, you won't be able to have the behavior you described, where a branch alias always points to the latest commit of the master branch. Instead, you would need to update the branch reference manually to point to the latest commit whenever you want it to reflect the changes from the master branch.

     

    If branch aliases are critical to your workflow, you might consider using a different Git hosting service that supports this feature, or you could explore using Git hooks or automation to manage the branch reference updates in your Azure Repos repository. However, keep in mind that this would require custom scripting and might not be as seamless as native branch alias support.

Resources