Skip to main content

Scripts for Git

About 32 minPowershellGitpowershellpwshwindowsscriptuseful-script

Scripts for Git 관련


build-repo.ps1

build-repo.ps1

Builds a Git repository.

This PowerShell script builds a repository by supporting: cmake, configure, autogen, Imakefile, and Makefile.

Parameters
PS> ./build-repo.ps1 [[-RepoDir] <String>] [<CommonParameters>]

-RepoDir <String>
    Specifies the path to the Git repository
    
    Required?                    false
    Position?                    1
    Default value                "$PWD"
    Accept pipeline input?       false
    Accept wildcard characters?  false

[<CommonParameters>]
    This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction, 
    WarningVariable, OutBuffer, PipelineVariable, and OutVariable.

build-repos.ps1

build-repos.ps1

Builds all Git repositories in a folder.

This PowerShell script builds all Git repositories in a folder.

Parameters
PS> ./build-repos.ps1 [[-ParentDir] <String>] [<CommonParameters>]

-ParentDir <String>
    Specifies the path to the parent folder
    
    Required?                    false
    Position?                    1
    Default value                "$PWD"
    Accept pipeline input?       false
    Accept wildcard characters?  false

[<CommonParameters>]
    This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction, 
    WarningVariable, OutBuffer, PipelineVariable, and OutVariable.

check-repo.ps1

check-repo.ps1

Checks a Git repository.

This PowerShell script verifies the integrity of a local Git repository.

Parameters
PS> ./check-repo.ps1 [[-RepoDir] <String>] [<CommonParameters>]

-RepoDir <String>
    Specifies the path to the Git repository (current working directory by default)
    
    Required?                    false
    Position?                    1
    Default value                "$PWD"
    Accept pipeline input?       false
    Accept wildcard characters?  false

[<CommonParameters>]
    This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction, 
    WarningVariable, OutBuffer, PipelineVariable, and OutVariable.

clean-repo.ps1

clean-repo.ps1

Cleans a Git repository from untracked files.

This PowerShell script deletes all untracked files and folders in a local Git repository (including submodules).

NOTE

To be used with care! This cannot be undone!

Parameters
PS> ./clean-repo.ps1 [[-RepoDir] <String>] [<CommonParameters>]

-RepoDir <String>
    Specifies the file path to the local Git repository
    
    Required?                    false
    Position?                    1
    Default value                "$PWD"
    Accept pipeline input?       false
    Accept wildcard characters?  false

[<CommonParameters>]
    This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction, 
    WarningVariable, OutBuffer, PipelineVariable, and OutVariable.

clean-repos.ps1

clean-repos.ps1

Cleans all Git repositories in a folder from untracked files.

This PowerShell script cleans all Git repositories in a folder from untracked files (including submodules).

Parameters
PS> ./clean-repos.ps1 [[-ParentDir] <String>] [<CommonParameters>]

-ParentDir <String>
    Specifies the path to the parent folder
    
    Required?                    false
    Position?                    1
    Default value                "$PWD"
    Accept pipeline input?       false
    Accept wildcard characters?  false

[<CommonParameters>]
    This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction, 
    WarningVariable, OutBuffer, PipelineVariable, and OutVariable.

clone-repos.ps1

clone-repos.ps1

Clones well-known Git repositories.

This PowerShell script clones popular Git repositories into a target directory.

Parameters
PS> ./clone-repos.ps1 [[-TargetDir] <String>] [<CommonParameters>]

-TargetDir <String>
    Specifies the file path to the target directory (current working directory by default)
    
    Required?                    false
    Position?                    1
    Default value                "$PWD"
    Accept pipeline input?       false
    Accept wildcard characters?  false

[<CommonParameters>]
    This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction, 
    WarningVariable, OutBuffer, PipelineVariable, and OutVariable.

configure-git.ps1

configure-git.ps1

Sets up the Git user configuration.

This PowerShell script configures the user settings for Git.

Parameters
PS> ./configure-git.ps1 [[-FullName] <String>] [[-EmailAddress] <String>] [[-FavoriteEditor] <String>] [<CommonParameters>]

-FullName <String>
    Specifies the user's full name
    
    Required?                    false
    Position?                    1
    Default value                
    Accept pipeline input?       false
    Accept wildcard characters?  false

-EmailAddress <String>
    Specifies the user's email address
    
    Required?                    false
    Position?                    2
    Default value                
    Accept pipeline input?       false
    Accept wildcard characters?  false

-FavoriteEditor <String>
    Specifies the user's favorite text editor
    
    Required?                    false
    Position?                    3
    Default value                
    Accept pipeline input?       false
    Accept wildcard characters?  false

[<CommonParameters>]
    This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction, 
    WarningVariable, OutBuffer, PipelineVariable, and OutVariable.

fetch-repo.ps1

fetch-repo.ps1

Fetches updates for a Git repository.

This PowerShell script fetches the latest updates into a local Git repository (including submodules).

Parameters
PS> ./fetch-repo.ps1 [[-RepoDir] <String>] [<CommonParameters>]

-RepoDir <String>
    Specifies the file path to the local Git repository (default is working directory).
    
    Required?                    false
    Position?                    1
    Default value                "$PWD"
    Accept pipeline input?       false
    Accept wildcard characters?  false

[<CommonParameters>]
    This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction, 
    WarningVariable, OutBuffer, PipelineVariable, and OutVariable.

fetch-repos.ps1

fetch-repos.ps1

Fetches updates for all Git repositories in a folder.

This PowerShell script fetches updates into all Git repositories in a folder (including submodules).

Parameters
PS> ./fetch-repos.ps1 [[-ParentDir] <String>] [<CommonParameters>]

-ParentDir <String>
    Specifies the path to the parent folder
    
    Required?                    false
    Position?                    1
    Default value                "$PWD"
    Accept pipeline input?       false
    Accept wildcard characters?  false

[<CommonParameters>]
    This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction, 
    WarningVariable, OutBuffer, PipelineVariable, and OutVariable.

list-branches.ps1

list-branches.ps1

Lists all branches in a Git repository.

This PowerShell script lists all branches in a Git repository.

Parameters
PS> ./list-branches.ps1 [[-RepoDir] <String>] [[-SearchPattern] <String>] [<CommonParameters>]

-RepoDir <String>
    Specifies the path to the Git repository (current working directory by default)
    
    Required?                    false
    Position?                    1
    Default value                "$PWD"
    Accept pipeline input?       false
    Accept wildcard characters?  false

-SearchPattern <String>
    Specifies the search patter (anything by default)
    
    Required?                    false
    Position?                    2
    Default value                *
    Accept pipeline input?       false
    Accept wildcard characters?  false

[<CommonParameters>]
    This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction, 
    WarningVariable, OutBuffer, PipelineVariable, and OutVariable.

list-commits.ps1

list-commits.ps1

Lists all commits in a Git repository.

This PowerShell script lists all commits in a Git repository. Supported output formats are: pretty, list, compact, normal or JSON.

Parameters
PS> ./list-commits.ps1 [[-RepoDir] <String>] [[-Format] <String>] [<CommonParameters>]

-RepoDir <String>
    Specifies the path to the Git repository.
    
    Required?                    false
    Position?                    1
    Default value                "$PWD"
    Accept pipeline input?       false
    Accept wildcard characters?  false

-Format <String>
    Specifies the output format: pretty|list|compact|normal|JSON (pretty by default)
    
    Required?                    false
    Position?                    2
    Default value                pretty
    Accept pipeline input?       false
    Accept wildcard characters?  false

[<CommonParameters>]
    This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction, 
    WarningVariable, OutBuffer, PipelineVariable, and OutVariable.

list-latest-tag.ps1

list-latest-tag.ps1

Lists the latest tag on the current branch in a Git repository.

This PowerShell script lists the latest tag on the current branch in a Git repository.

Parameters
PS> ./list-latest-tag.ps1 [[-RepoDir] <String>] [<CommonParameters>]

-RepoDir <String>
    Specifies the path to the repository
    
    Required?                    false
    Position?                    1
    Default value                "$PWD"
    Accept pipeline input?       false
    Accept wildcard characters?  false

[<CommonParameters>]
    This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction, 
    WarningVariable, OutBuffer, PipelineVariable, and OutVariable.

list-latest-tags.ps1

list-latest-tags.ps1

Lists the latests tags in all Git repositories under a directory.

This PowerShell script lists the latest tags in all Git repositories in the specified folder.

Parameters
PS> ./list-latest-tags.ps1 [[-ParentDir] <String>] [<CommonParameters>]

-ParentDir <String>
    Specifies the path to the parent folder
    
    Required?                    false
    Position?                    1
    Default value                "$PWD"
    Accept pipeline input?       false
    Accept wildcard characters?  false

[<CommonParameters>]
    This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction, 
    WarningVariable, OutBuffer, PipelineVariable, and OutVariable.

list-repos.ps1

list-repos.ps1

Lists the Git repositories in a folder.

This PowerShell script lists details of all Git repositories in a folder.

Parameters
PS> ./list-repos.ps1 [[-ParentDir] <String>] [<CommonParameters>]

-ParentDir <String>
    Specifies the path to the parent directory.
    
    Required?                    false
    Position?                    1
    Default value                "$PWD"
    Accept pipeline input?       false
    Accept wildcard characters?  false

[<CommonParameters>]
    This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction, 
    WarningVariable, OutBuffer, PipelineVariable, and OutVariable.

list-submodules.ps1

list-submodules.ps1

Lists the submodules in a Git repository.

This PowerShell script lists the submodules in the given Git repository.

Parameters
PS> ./list-submodules.ps1 [[-RepoDir] <String>] [<CommonParameters>]

-RepoDir <String>
    Specifies the path to the repository (current working directory by default)
    
    Required?                    false
    Position?                    1
    Default value                "$PWD"
    Accept pipeline input?       false
    Accept wildcard characters?  false

[<CommonParameters>]
    This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction, 
    WarningVariable, OutBuffer, PipelineVariable, and OutVariable.

list-tags.ps1

list-tags.ps1

Lists all tags in a Git repository.

This PowerShell script fetches all tags of a Git repository and lists it.

Parameters
PS> ./list-tags.ps1 [[-RepoDir] <String>] [[-SearchPattern] <String>] [<CommonParameters>]

-RepoDir <String>
    Specifies the path to the Git repository (current working directory by default)
    
    Required?                    false
    Position?                    1
    Default value                "$PWD"
    Accept pipeline input?       false
    Accept wildcard characters?  false

-SearchPattern <String>
    Specifies the search pattern (anything by default)
    
    Required?                    false
    Position?                    2
    Default value                *
    Accept pipeline input?       false
    Accept wildcard characters?  false

[<CommonParameters>]
    This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction, 
    WarningVariable, OutBuffer, PipelineVariable, and OutVariable.

new-branch.ps1

new-branch.ps1

Creates a new branch in a Git repository.

This PowerShell script creates a new branch in a local Git repository and switches to it.

Parameters
PS> ./new-branch.ps1 [[-newBranch] <String>] [[-repoPath] <String>] [<CommonParameters>]

-newBranch <String>
    Specifies the new branch name
    
    Required?                    false
    Position?                    1
    Default value                
    Accept pipeline input?       false
    Accept wildcard characters?  false

-repoPath <String>
    Specifies the path to the Git repository (current working directory per default)
    
    Required?                    false
    Position?                    2
    Default value                "$PWD"
    Accept pipeline input?       false
    Accept wildcard characters?  false

[<CommonParameters>]
    This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction, 
    WarningVariable, OutBuffer, PipelineVariable, and OutVariable.

new-tag.ps1

new-tag.ps1

Creates a new tag in a Git repository.

This PowerShell script creates a new tag in a Git repository.

Parameters
PS> ./new-tag.ps1 [[-TagName] <String>] [[-RepoDir] <String>] [<CommonParameters>]

-TagName <String>
    Specifies the new tag name
    
    Required?                    false
    Position?                    1
    Default value                
    Accept pipeline input?       false
    Accept wildcard characters?  false

-RepoDir <String>
    Specifies the path to the Git repository
    
    Required?                    false
    Position?                    2
    Default value                "$PWD"
    Accept pipeline input?       false
    Accept wildcard characters?  false

[<CommonParameters>]
    This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction, 
    WarningVariable, OutBuffer, PipelineVariable, and OutVariable.

pick-commit.ps1

pick-commit.ps1

Cherry-picks a Git commit into multiple branches.

Cherry-picks a Git commit into one or more branches (branch names need to be separated by spaces)

NOTE

in case of merge conflicts the script stops immediately!

Parameters
PS> ./pick-commit.ps1 [[-CommitID] <String>] [[-CommitMessage] <String>] [[-Branches] <String>] [[-RepoDir] <String>] [<CommonParameters>]

-CommitID <String>
    Specifies the commit ID
    
    Required?                    false
    Position?                    1
    Default value                
    Accept pipeline input?       false
    Accept wildcard characters?  false

-CommitMessage <String>
    Specifies the commit message to use
    
    Required?                    false
    Position?                    2
    Default value                
    Accept pipeline input?       false
    Accept wildcard characters?  false

-Branches <String>
    Specifies the list of branches, separated by spaces
    
    Required?                    false
    Position?                    3
    Default value                
    Accept pipeline input?       false
    Accept wildcard characters?  false

-RepoDir <String>
    Specifies the path to the Git repository
    
    Required?                    false
    Position?                    4
    Default value                "$PWD"
    Accept pipeline input?       false
    Accept wildcard characters?  false

[<CommonParameters>]
    This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction, 
    WarningVariable, OutBuffer, PipelineVariable, and OutVariable.

pull-repo.ps1

pull-repo.ps1

Pulls updates for a Git repository.

This PowerShell script pulls the latest updates into a local Git repository (including submodules).

Parameters
PS> ./pull-repo.ps1 [[-RepoDir] <String>] [<CommonParameters>]

-RepoDir <String>
    Specifies the file path to the local Git repository (default is working directory)
    
    Required?                    false
    Position?                    1
    Default value                "$PWD"
    Accept pipeline input?       false
    Accept wildcard characters?  false

[<CommonParameters>]
    This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction, 
    WarningVariable, OutBuffer, PipelineVariable, and OutVariable.

pull-repos.ps1

pull-repos.ps1

Pulls updates for all Git repositories in a folder.

This PowerShell script pulls updates into all Git repositories in a folder (including submodules).

Parameters
PS> ./pull-repos.ps1 [[-ParentDir] <String>] [<CommonParameters>]

-ParentDir <String>
    Specifies the path to the parent folder
    
    Required?                    false
    Position?                    1
    Default value                "$PWD"
    Accept pipeline input?       false
    Accept wildcard characters?  false

[<CommonParameters>]
    This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction, 
    WarningVariable, OutBuffer, PipelineVariable, and OutVariable.

remove-tag.ps1

remove-tag.ps1

Removes a tag in a Git repository.

This PowerShell script removes a Git tag, either locally, remote, or both.

Parameters
PS> ./remove-tag.ps1 [[-TagName] <String>] [[-Mode] <String>] [[-RepoDir] <String>] [<CommonParameters>]

-TagName <String>
    Specifies the Git tag name
    
    Required?                    false
    Position?                    1
    Default value                
    Accept pipeline input?       false
    Accept wildcard characters?  false

-Mode <String>
    Specifies either locally, remote, or both
    
    Required?                    false
    Position?                    2
    Default value                
    Accept pipeline input?       false
    Accept wildcard characters?  false

-RepoDir <String>
    Specifies the path to the Git repository
    
    Required?                    false
    Position?                    3
    Default value                "$PWD"
    Accept pipeline input?       false
    Accept wildcard characters?  false

[<CommonParameters>]
    This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction, 
    WarningVariable, OutBuffer, PipelineVariable, and OutVariable.

switch-branch.ps1

switch-branch.ps1

Switches the branch in a Git repository.

This PowerShell script switches to another branch in a Git repository (including submodules).

Parameters
PS> ./switch-branch.ps1 [[-BranchName] <String>] [[-RepoDir] <String>] [<CommonParameters>]

-BranchName <String>
    Specifies the branch name
    
    Required?                    false
    Position?                    1
    Default value                
    Accept pipeline input?       false
    Accept wildcard characters?  false

-RepoDir <String>
    Specifies the path to the local Git repository
    
    Required?                    false
    Position?                    2
    Default value                "$PWD"
    Accept pipeline input?       false
    Accept wildcard characters?  false

[<CommonParameters>]
    This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction, 
    WarningVariable, OutBuffer, PipelineVariable, and OutVariable.

sync-repo.ps1

sync-repo.ps1

Synchronizes a Git repository by pull & push.

This PowerShell script synchronizes a local Git repository by pull and push (including submodules).

Parameters
PS> ./sync-repo.ps1 [[-path] <String>] [<CommonParameters>]

-path <String>
    Specifies the path to the Git repository
    
    Required?                    false
    Position?                    1
    Default value                "$PWD"
    Accept pipeline input?       false
    Accept wildcard characters?  false

[<CommonParameters>]
    This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction, 
    WarningVariable, OutBuffer, PipelineVariable, and OutVariable.

이찬희 (MarkiiimarK)
Never Stop Learning.