My personal collection of custom git functions.
In order for you to effectively make use of this repository, you'll need to clone down
its contents and ensure that they are in your PATH
.
Nota Bene: I keep this in my home directory, but you can put in anywhere
so long as it's added to your PATH
accordingly.
$ cd $HOME
$ git clone https://github.com/codebytere/git-fns
$ export PATH=$PATH:$HOME/git-fns/fns
-l|--location=<location>
- The location on disk where the file will be created. Defaults to$HOME/Desktop
.-n|--name=<name>
- The name of the file to create or append to. Defaults tolocal_diff
.-a|--append
- Append to the file instead of overwriting it.
Allow a user to quickly export a diff in patch format to a file at a chosen location. Defaults to a file named local_diff
created at $HOME/Desktop
.
Example:
electron on git:master ❯ git patch-out -l=$HOME/Downloads --append
-f|--filepath=<filepath>
- The path to the file to stage and add to the last commit.
A quick way to add a forgotten change to the most recent commit in a branch without needing to create a new one for a trivial change. Automatically pushes to the current working branch.
Example:
electron on git:master ❯ git tack README.md
-r|remote=<remote>
- The name of the git remote. Defaults toorigin
.-b|--branch=<branch>
- The name of the remote branch to rebase against. Defaults tomaster
.
Cleanly rebase a local working branch on a remote branch.
Example:
electron on git:master ❯ git refresh -r=codebytere -b=testing
-u|--url=<url>
- The url for the commit to apply to your current working branch.
Apply a patch from a remote commit url to your current working branch.
Example:
electron on git:master ❯ git patch-apply https://github.com/electron/electron/commit/d2a82dbd1d2bd3869f910dd563001b98b3cec736
-u|--upstream=<upstream>
- The name of the upstream git remote. Defaults toupstream
.-o|--origin=<origin>
- The name of the origin git remote. Defaults toorigin
.
Fetch latest commits from an upstream branch and update your origin with those commits.
Example:
electron on git:master ❯ git sync
I've also included custom man pages for each of these new functions, which will need to be
added to your MANPATH
in order to work properly.
Assuming you have already cloned down the directory as directed above:
$ cd $HOME
$ export MANPATH=$MANPATH:$HOME/git-fns/man
You will then be able to run:
# Or any other custom function.
$ man git-tack
to see:
man(1) git tack man page man(1)
NAME
git tack - Add a forgotten change to the most recent commit in a
branch.
SYNOPSIS
git tack [-f|--filepath=<path>]
DESCRIPTION
A quick way to add a forgotten change to the most recent commit in a
branch without needing to create a new commit. Automatically pushes to
the current branch.
OPTIONS
[-f|--filepath=<path>]
The path to the file to stage and add to the last commit.
BUGS
No known bugs.
AUTHOR
Shelley Vohr <shelley.vohr@gmail.com>
1.0 November 2019 man(1)