# Git Repo Registration - all commands support `-debug` ## New-GitRepoRegistration `New-GitRepoRegistration [-Name string]` Creates a new registration for the current directory, optionally registering against the given name. If `-Name` is not given the folder for the root level of the git repo will be used. Name registrations are _not_ case-sensitive, so registrations can be made using different cases for the same location, and multiple registrations can exist for the git repository. ```pwsh # Default registration PS D:/Repos/Project-a> New-GitRepoRegistration -debug DEBUG: Checking if current directory is a git repository... DEBUG: ...location is a git repo! DEBUG: No name given for registration, defaulting to git folder root. DEBUG: Registered 'D:/Repos/Project-a' to name 'Project-a' # Named registration PS D:/Repos/Project-a> New-GitRepoRegistration "test repo" -debug DEBUG: Checking if current directory is a git repository... DEBUG: ...location is a git repo! DEBUG: Registered 'D:/Repos/Project-a' to name 'test repo' PS D:/Repos/Project-a> Get-GitRepoRegistration Name Location CurrentBranch ---- -------- ------------- test-repo D:/Repos/Project-a main Project-a D:/Repos/Project-a main ``` If the current directory is not in a git repo, a registration already exists by name or default folder, or if any other issue occurs such as git not being available an error will be thrown. ## Get-GitRepoRegistration `Get-GitRepoRegistration` Returns all currently registered git repositories, as well as their current branch. ```pwsh PS D:/Repos/Project-a> Get-GitRepoRegistration Name Location CurrentBranch ---- -------- ------------- test-repo D:/Repos/Project-a main Project-a D:/Repos/Project-a main ``` The current branch is cached for 15 minutes for performance reasons so it may not be up to date if a git repo has recently had its branch changed. ## Show-GitRepoRegistration `Show-GitRepoRegistration -Name string [-NoStack|-NoPushLocation]` Changes your location to the location of the git repo registered by the given `-Name`. If used without `-NoStack` or its alias `-NoPushLocation`, your original location will be preserved and can be returned to at any time via `Pop-Location`/`Popd`. Using `-NoStack`/`-NoPushLocation` will not push your current location onto the stack, and will behave the same as `cd`/`Set-Location`. ## Remove-GitRepoRegistration `Remove-GitRepoRegistration [-Name string]`