Published: 2021.04.30
Category: PowerShell
Manage Git repositories
Module allows to manage multiple repositories at the same time. I am using it as a backup tool.
Every day I am scanning my repositories and check if any of it has some uncommited changes. If yes, changes are pushed. If changes weren’t staged, new AutoCommitBranch branch is created and data is pushed there.
Module also allow me to update all repositories from given directory.
Check out detailed description of the commands below.
Pull-GitRepository
Performs git pull for given directory. Following command will
- open
D:\GitHub\ProductivityTools.ConnectionString\
- check if directory is git repository
- perform git pull
- show message.

Pull-GitRepositories
Iterates through list of directories under directory provided and invokes git pull for each repository.

Push-GitRepository
It pushes changes to the Git repository. If current branch is ahead of remote, it will push it, if changes are not commited it will create AutoCommit branch and push all changes to it.


Push-GitRepositories
It iterates through given directory and for each directory inside it will invoke Push-GitRepository cmdlet.
It will open GitHub directory and foreach directory inside it will invoke Push-GitRepository

Get-AutoCommitRepository
Checks if git repository contains AutoCommitBranch branch.

Get-AutoCommitRepositories
Iterates through all git repositories inside provided directory and invokes Get-AutoCommitRepository for each.

Get-GitRepositoryStatus
Checks if given repository has something to be commited.

Get-GitRepositoriesStatus
Iterates through all git repositories inside provided directory and invokes Get-GitRepositoryStatus for each.
