Skip to content

MichaelAquilina/git-commands

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

82 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Git Commands

CircleCI GPLv3

Helper commands for git.

git-web

Opens the relevant web page for the git repository. By default this opens the repository for the "origin" remote.

Open up a web page for the default origin remote:

git web

Open up web page for other specified remote:

git web upstream

Open up the issues page:

git web --issues

Open up all open pull requests:

git web --pulls

Open new pull request for current branch:

git web --pull-request

Configution

git config web.opencommand: Set the command to use when opening urls by setting

git config web.default.pulls: Default url path to use for pull requests

git config web.default.issues: Default url path to use for issues

git config web.$DOMAIN.pulls: Path to use for pull requests for $DOMAIN

git config web.$DOMAIN.issues: Path to use for issues for $DOMAIN

Installation

place git-web into any directory which is in your $PATH

Alternatively, if you are using zplug on zsh then this can easily be done by adding the following to ~/.zshrc:

zplug "MichaelAquilina/git-commands", \
    as:command, \
    use:git-web

git-clean-branches

Cleans (delete) any branches that have been been merged into master. This should make your life easier when figuring out which local branches are no longer important.

Delete all local branches that have been merged into master:

git clean-branches

Force delete any branches that might be in an inconistent state:

git clean-branches -D

git-default-branch

Prints out the default branch of the repository (typically main or master) by querying the HEAD of the origin remote.

This is a useful command to have when used in combination with other functions and aliases you might have.

For example, the alias below would fail on any repositories which do not use main as the default branch.

alias grim="git rebase -i main"

However we can change this to use git-default-branch to make it work for any repository:

alias grim="git rebase -i $$(git default-branch)"

Installation

place git-clean-branches into any directory which is in your $PATH

Alternatively, if you are using zplug on zsh then this can easily be done by adding the following to ~/.zshrc:

zplug "MichaelAquilina/git-commands", \
    as:command, \
    use:git-clean-branches

About

Various helpful git commands for your git workflow

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages