Skip to content

A collection of PowerShell scripts for streamlined management of local branches in Git repositories.

License

Notifications You must be signed in to change notification settings

codymcelroy/script-git

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 

Repository files navigation

PowerShell Git Scripts

List-Branches

Searches for all Git repositories in the current directory and its subdirectories, excluding a specified directory. It then iterates over each repository, checks and displays the local branches.

Graph-Branches

Displays a tree-node diagram of their branches. It excludes a specified directory and its subdirectories from the search. The script retrieves the branches as tree nodes and replaces ASCII characters with custom graphics for better visualization. It also identifies the current branch and outputs the branch diagram for each Git repository found. Improve your understanding of Git branch structure with this script.

Prune-Branches

Prunes local branches in Git repositories within a specified directory while excluding a particular directory and its subdirectories. It provides an option for a dry run (-dryRun switch) to preview branch deletions without executing them. The following steps outline how to use the script:

  1. Save the script as a .ps1 file.
  2. Open a PowerShell terminal.
  3. Navigate to the directory where the script is saved.
  4. Run the script with the desired options, such as .\prune_local.ps1 -dryRun.
  5. Modify the $search_directory and $excluded_directory variables within the script to specify the target directory and excluded directory, respectively.
  6. If not in dry run mode, the script prompts for confirmation before deleting each branch.

About

A collection of PowerShell scripts for streamlined management of local branches in Git repositories.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published