Gitsy is a set of versatile bash utilities designed to make managing Git repositories easier, faster, and more efficient. It provides user-friendly commands to automate common Git operations such as checking out branches, pushing, pulling, creating worktrees, stashing changes, and viewing git status — all enhanced with helpful prompts, color-coded outputs, and automation.
g-co--target-branch, --stash-changesg-pull--target-branch, --fetchg-push--target-branch, --forceg-wa--target-branch, --stash-changesg-wr--target-branch, --worktree-nameg-db--target-branchg-dlc--forceg-rmf--messageg-rtog-cbg-sg-diff--source-branch, --target-branch, --full, --files-onlyg-cog-pullg-pushg-wag-wrg-dbg-dlcg-rmfg-rtog-cbg-sg-diffInstall gitsy globally using npm. You'll also need to install the required dependencies (git, figlet, lolcat) for your platform:
# Install globally via npm
npm install -g gitsy
# Install dependencies (required)
# macOS
brew install git figlet lolcat
# Ubuntu/Debian
sudo apt-get install git figlet lolcat
# Fedora/RHEL
sudo dnf install git figlet lolcat
# Verify installation
g-s --helpOnce installed, all commands (g-s, g-co, g-pull, etc.) will be available globally in your terminal.
Each script corresponds to a Git-related utility. Below is a comprehensive guide on all available commands.
Checkout to a branch, with optional stash.
g-co - attempt to checkout to branch
g-co [options]
options:
-h, --help show brief help
--target-branch BRANCH, --target-branch=BRANCH, -t=BRANCH, -t BRANCH specify the target branch
--stash-changes stash changes before proceedingUsage examples:
# Checkout to a branch
g-co -t feature/xyz
# With stash
g-co -t main --stash-changesThe command will automatically:
--stash-changes flag is providedPull changes from a remote branch.
g-pull - pull changes from remote branch
g-pull [options]
options:
-h, --help show brief help
--target-branch BRANCH, --target-branch=BRANCH, -t=BRANCH, -t BRANCH specify the target branch
--stash-changes stash changes before proceeding
-f, --fetch fetch changes before pullingUsage examples:
# Pull current branch
g-pull
# Pull specific branch with fetch
g-pull -t develop -fThe command will automatically:
-f/--fetch flag is providedPush changes to a remote branch, optionally with force.
g-push - push changes to remote branch
g-push [options]
options:
-h, --help show brief help
--target-branch BRANCH, --target-branch=BRANCH, -t=BRANCH, -t BRANCH specify the target branch
--stash-changes stash changes before proceeding
--force force push changes to the target branchUsage examples:
# Push current branch
g-push
# Force push
g-push --forceWarning: Using --force will overwrite remote history. This can cause data loss for collaborators who have already pulled the branch. Only use force push when you're certain it's safe.
The command will automatically:
--force flag is provided (use with caution)Create a new git worktree with intelligent repository restructuring. On first use, automatically reorganizes your repository to support multiple worktrees. New branches are created from your current branch, preserving your branch context.
g-wa - create git worktree for branch
g-wa [options]
options:
-h, --help show brief help
--target-branch BRANCH, --target-branch=BRANCH, -t=BRANCH, -t BRANCH specify the target branch
--stash-changes stash changes before proceedingUsage examples:
# Create worktree for branch (creates ../worktrees/feature_new_feature)
# If you're on develop, the new branch will be cut from develop
g-wa -t feature/new-feature
# With stash (creates ../worktrees/develop)
g-wa -t develop --stash-changesRepository Restructuring: On first use, g-wa will automatically reorganize your repository:
main/ subdirectoryworktrees/ directory for feature branchesFinal structure:
your-repo/
├── main/ # Default branch (main/master)
└── worktrees/ # Feature branch worktrees
├── feature_1/
├── feature_2/
└── bugfix_abc/The command will automatically:
main/ subdirectoryworktrees/ directory structure_)/Users/you/projects/your-repo/worktrees/feature_name)feature/this-is-a-very-long-branch-name → feature_this_is_a_very_long_br..)--stash-changes flagBranch Context: When creating a new branch, it will be cut from your current branch. For example, if you're on develop and run g-wa -t feature/new, the new branch will be created from develop, not from main. This ensures your new branch inherits the correct context.
Remove a git worktree by branch name or worktree directory name.
g-wr - remove a git worktree for a specified branch or name
g-wr [options]
options:
-h, --help show brief help
--target-branch BRANCH, --target-branch=BRANCH, -t=BRANCH, -t BRANCH specify the target branch
--worktree-name NAME, --worktree-name=NAME, -w=NAME, -w NAME specify the worktree directory nameUsage examples:
# Remove by branch name
g-wr -t feature/old-feature
# Remove by sanitized worktree directory name
g-wr -w feature_old_featureThe command will automatically:
Delete a branch locally and optionally push the deletion to remote.
g-db - delete a branch locally and optionally on remote
g-db [options]
options:
-h, --help show brief help
--target-branch BRANCH, --target-branch=BRANCH, -t=BRANCH, -t BRANCH specify the branch to deleteUsage examples:
# Delete branch (prompts for remote deletion)
g-db -t feature/completedThe command will automatically:
Discard the last commit with optional force mode.
g-dlc - discard the last commit
g-dlc [options]
options:
-h, --help show brief help
-f, --force force discard without checking uncommitted changesUsage examples:
# Discard last commit (soft reset)
g-dlc
# Force discard (hard reset)
g-dlc --forceWarning: Using --force performs a hard reset, permanently discarding all uncommitted changes in your working directory. This action cannot be undone.
The command will automatically:
--force is used)--force flagClear your working directory by stashing all changes with a timestamped message.
g-rmf - clear your working directory by stashing changes
g-rmf [options]
options:
-h, --help show brief help
--message MESSAGE, --message=MESSAGE, -m=MESSAGE, -m MESSAGE specify custom message for stashUsage examples:
# Stash with auto-generated message
g-rmf
# Stash with custom message
g-rmf -m "WIP: refactoring"The command will automatically:
Reset your working directory hard to the latest remote branch, stashing changes beforehand.
g-rto - reset to remote branch
g-rto [options]
options:
-h, --help show brief helpUsage examples:
# Reset current branch to remote
g-rtoThe command will automatically:
Display the current git branch name.
g-cb - show current branch name
g-cb [options]
options:
-h, --help show brief helpUsage examples:
# Show current branch (copies to clipboard)
g-cbThe command will automatically:
Show the output of git status.
g-s - show git status
g-s [options]
options:
-h, --help show brief helpUsage examples:
# Show git status
g-sThe command will automatically:
Compare and show differences between two branches.
g-diff - compare changes between two git branches
g-diff [options]
options:
-h, --help show brief help
--target-branch BRANCH, --target-branch=BRANCH, -t=BRANCH, -t BRANCH specify the target branch
--source-branch BRANCH, --source-branch=BRANCH, -s=BRANCH, -s BRANCH specify the source branch (defaults to current branch)
-f, --full show full diff and copy to clipboard
--files-only show only file names (no stats, no clipboard)Usage examples:
# Compare current branch with target (shows stats, copies stats to clipboard)
g-diff -t main
# Compare two branches
g-diff -s feature/a -t feature/b
# Show only file names (no stats, no clipboard)
g-diff -t main --files-only
# Full diff (copies formatted diff to clipboard)
g-diff -t main --fullThe command will automatically:
Default mode (no flags):
Example clipboard content:
src/components/Button.tsx | 23 ++++++---------
src/utils/helper.ts | 4 ++--
src/pages/index.tsx | 15 +++++++++++
3 files changed, 28 insertions(+), 13 deletions(-)With --files-only:
Example output:
src/components/Button.tsx
src/utils/helper.ts
src/pages/index.tsxWith --full:
Example clipboard content:
file: src/components/Button.tsx
stats: +15 -8
changes:
@@ -10,7 +10,9 @@ export function Button() {
- const handleClick = () => {
- console.log('clicked');
- };
+ const handleClick = useCallback(() => {
+ console.log('Button clicked');
+ onAction();
+ }, [onAction]);
file: src/utils/helper.ts
stats: +3 -1
changes:
@@ -5,7 +5,9 @@ export function formatDate() {
- return new Date().toISOString();
+ return new Date().toLocaleString('en-US', {
+ dateStyle: 'medium'
+ });Contributions are welcome! Please fork the repository and submit pull requests. For bugs or feature requests, open an issue on the repository.
View source code, report issues, and contributeThis project is licensed under the MIT License.
Author: Santhosh Siva
GitHub: https://github.com/san-siva
Gitsy is a set of versatile bash utilities designed to make managing Git repositories easier, faster, and more efficient. It provides user-friendly commands to automate common Git operations such as checking out branches, pushing, pulling, creating worktrees, stashing changes, and viewing git status — all enhanced with helpful prompts, color-coded outputs, and automation.
g-co--target-branch, --stash-changesg-pull--target-branch, --fetchg-push--target-branch, --forceg-wa--target-branch, --stash-changesg-wr--target-branch, --worktree-nameg-db--target-branchg-dlc--forceg-rmf--messageg-rtog-cbg-sg-diff--source-branch, --target-branch, --full, --files-onlyg-cog-pullg-pushg-wag-wrg-dbg-dlcg-rmfg-rtog-cbg-sg-diffInstall gitsy globally using npm. You'll also need to install the required dependencies (git, figlet, lolcat) for your platform:
# Install globally via npm
npm install -g gitsy
# Install dependencies (required)
# macOS
brew install git figlet lolcat
# Ubuntu/Debian
sudo apt-get install git figlet lolcat
# Fedora/RHEL
sudo dnf install git figlet lolcat
# Verify installation
g-s --helpOnce installed, all commands (g-s, g-co, g-pull, etc.) will be available globally in your terminal.
Each script corresponds to a Git-related utility. Below is a comprehensive guide on all available commands.
Checkout to a branch, with optional stash.
g-co - attempt to checkout to branch
g-co [options]
options:
-h, --help show brief help
--target-branch BRANCH, --target-branch=BRANCH, -t=BRANCH, -t BRANCH specify the target branch
--stash-changes stash changes before proceedingUsage examples:
# Checkout to a branch
g-co -t feature/xyz
# With stash
g-co -t main --stash-changesThe command will automatically:
--stash-changes flag is providedPull changes from a remote branch.
g-pull - pull changes from remote branch
g-pull [options]
options:
-h, --help show brief help
--target-branch BRANCH, --target-branch=BRANCH, -t=BRANCH, -t BRANCH specify the target branch
--stash-changes stash changes before proceeding
-f, --fetch fetch changes before pullingUsage examples:
# Pull current branch
g-pull
# Pull specific branch with fetch
g-pull -t develop -fThe command will automatically:
-f/--fetch flag is providedPush changes to a remote branch, optionally with force.
g-push - push changes to remote branch
g-push [options]
options:
-h, --help show brief help
--target-branch BRANCH, --target-branch=BRANCH, -t=BRANCH, -t BRANCH specify the target branch
--stash-changes stash changes before proceeding
--force force push changes to the target branchUsage examples:
# Push current branch
g-push
# Force push
g-push --forceWarning: Using --force will overwrite remote history. This can cause data loss for collaborators who have already pulled the branch. Only use force push when you're certain it's safe.
The command will automatically:
--force flag is provided (use with caution)Create a new git worktree with intelligent repository restructuring. On first use, automatically reorganizes your repository to support multiple worktrees. New branches are created from your current branch, preserving your branch context.
g-wa - create git worktree for branch
g-wa [options]
options:
-h, --help show brief help
--target-branch BRANCH, --target-branch=BRANCH, -t=BRANCH, -t BRANCH specify the target branch
--stash-changes stash changes before proceedingUsage examples:
# Create worktree for branch (creates ../worktrees/feature_new_feature)
# If you're on develop, the new branch will be cut from develop
g-wa -t feature/new-feature
# With stash (creates ../worktrees/develop)
g-wa -t develop --stash-changesRepository Restructuring: On first use, g-wa will automatically reorganize your repository:
main/ subdirectoryworktrees/ directory for feature branchesFinal structure:
your-repo/
├── main/ # Default branch (main/master)
└── worktrees/ # Feature branch worktrees
├── feature_1/
├── feature_2/
└── bugfix_abc/The command will automatically:
main/ subdirectoryworktrees/ directory structure_)/Users/you/projects/your-repo/worktrees/feature_name)feature/this-is-a-very-long-branch-name → feature_this_is_a_very_long_br..)--stash-changes flagBranch Context: When creating a new branch, it will be cut from your current branch. For example, if you're on develop and run g-wa -t feature/new, the new branch will be created from develop, not from main. This ensures your new branch inherits the correct context.
Remove a git worktree by branch name or worktree directory name.
g-wr - remove a git worktree for a specified branch or name
g-wr [options]
options:
-h, --help show brief help
--target-branch BRANCH, --target-branch=BRANCH, -t=BRANCH, -t BRANCH specify the target branch
--worktree-name NAME, --worktree-name=NAME, -w=NAME, -w NAME specify the worktree directory nameUsage examples:
# Remove by branch name
g-wr -t feature/old-feature
# Remove by sanitized worktree directory name
g-wr -w feature_old_featureThe command will automatically:
Delete a branch locally and optionally push the deletion to remote.
g-db - delete a branch locally and optionally on remote
g-db [options]
options:
-h, --help show brief help
--target-branch BRANCH, --target-branch=BRANCH, -t=BRANCH, -t BRANCH specify the branch to deleteUsage examples:
# Delete branch (prompts for remote deletion)
g-db -t feature/completedThe command will automatically:
Discard the last commit with optional force mode.
g-dlc - discard the last commit
g-dlc [options]
options:
-h, --help show brief help
-f, --force force discard without checking uncommitted changesUsage examples:
# Discard last commit (soft reset)
g-dlc
# Force discard (hard reset)
g-dlc --forceWarning: Using --force performs a hard reset, permanently discarding all uncommitted changes in your working directory. This action cannot be undone.
The command will automatically:
--force is used)--force flagClear your working directory by stashing all changes with a timestamped message.
g-rmf - clear your working directory by stashing changes
g-rmf [options]
options:
-h, --help show brief help
--message MESSAGE, --message=MESSAGE, -m=MESSAGE, -m MESSAGE specify custom message for stashUsage examples:
# Stash with auto-generated message
g-rmf
# Stash with custom message
g-rmf -m "WIP: refactoring"The command will automatically:
Reset your working directory hard to the latest remote branch, stashing changes beforehand.
g-rto - reset to remote branch
g-rto [options]
options:
-h, --help show brief helpUsage examples:
# Reset current branch to remote
g-rtoThe command will automatically:
Display the current git branch name.
g-cb - show current branch name
g-cb [options]
options:
-h, --help show brief helpUsage examples:
# Show current branch (copies to clipboard)
g-cbThe command will automatically:
Show the output of git status.
g-s - show git status
g-s [options]
options:
-h, --help show brief helpUsage examples:
# Show git status
g-sThe command will automatically:
Compare and show differences between two branches.
g-diff - compare changes between two git branches
g-diff [options]
options:
-h, --help show brief help
--target-branch BRANCH, --target-branch=BRANCH, -t=BRANCH, -t BRANCH specify the target branch
--source-branch BRANCH, --source-branch=BRANCH, -s=BRANCH, -s BRANCH specify the source branch (defaults to current branch)
-f, --full show full diff and copy to clipboard
--files-only show only file names (no stats, no clipboard)Usage examples:
# Compare current branch with target (shows stats, copies stats to clipboard)
g-diff -t main
# Compare two branches
g-diff -s feature/a -t feature/b
# Show only file names (no stats, no clipboard)
g-diff -t main --files-only
# Full diff (copies formatted diff to clipboard)
g-diff -t main --fullThe command will automatically:
Default mode (no flags):
Example clipboard content:
src/components/Button.tsx | 23 ++++++---------
src/utils/helper.ts | 4 ++--
src/pages/index.tsx | 15 +++++++++++
3 files changed, 28 insertions(+), 13 deletions(-)With --files-only:
Example output:
src/components/Button.tsx
src/utils/helper.ts
src/pages/index.tsxWith --full:
Example clipboard content:
file: src/components/Button.tsx
stats: +15 -8
changes:
@@ -10,7 +10,9 @@ export function Button() {
- const handleClick = () => {
- console.log('clicked');
- };
+ const handleClick = useCallback(() => {
+ console.log('Button clicked');
+ onAction();
+ }, [onAction]);
file: src/utils/helper.ts
stats: +3 -1
changes:
@@ -5,7 +5,9 @@ export function formatDate() {
- return new Date().toISOString();
+ return new Date().toLocaleString('en-US', {
+ dateStyle: 'medium'
+ });Contributions are welcome! Please fork the repository and submit pull requests. For bugs or feature requests, open an issue on the repository.
View source code, report issues, and contributeThis project is licensed under the MIT License.
Author: Santhosh Siva
GitHub: https://github.com/san-siva
Gitsy is a set of versatile bash utilities designed to make managing Git repositories easier, faster, and more efficient. It provides user-friendly commands to automate common Git operations such as checking out branches, pushing, pulling, creating worktrees, stashing changes, and viewing git status — all enhanced with helpful prompts, color-coded outputs, and automation.
g-co--target-branch, --stash-changesg-pull--target-branch, --fetchg-push--target-branch, --forceg-wa--target-branch, --stash-changesg-wr--target-branch, --worktree-nameg-db--target-branchg-dlc--forceg-rmf--messageg-rtog-cbg-sg-diff--source-branch, --target-branch, --full, --files-onlyg-cog-pullg-pushg-wag-wrg-dbg-dlcg-rmfg-rtog-cbg-sg-diffInstall gitsy globally using npm. You'll also need to install the required dependencies (git, figlet, lolcat) for your platform:
1# Install globally via npm
2npm install -g gitsy
3
4# Install dependencies (required)
5# macOS
6brew install git figlet lolcat
7
8# Ubuntu/Debian
9sudo apt-get install git figlet lolcat
10
11# Fedora/RHEL
12sudo dnf install git figlet lolcat
13
14# Verify installation
15g-s --helpOnce installed, all commands (g-s, g-co, g-pull, etc.) will be available globally in your terminal.
1# Install globally via npm
2npm install -g gitsy
3
4# Install dependencies (required)
5# macOS
6brew install git figlet lolcat
7
8# Ubuntu/Debian
9sudo apt-get install git figlet lolcat
10
11# Fedora/RHEL
12sudo dnf install git figlet lolcat
13
14# Verify installation
15g-s --helpEach script corresponds to a Git-related utility. Below is a comprehensive guide on all available commands.
Checkout to a branch, with optional stash.
g-co - attempt to checkout to branch
g-co [options]
options:
-h, --help show brief help
--target-branch BRANCH, --target-branch=BRANCH, -t=BRANCH, -t BRANCH specify the target branch
--stash-changes stash changes before proceedingUsage examples:
# Checkout to a branch
g-co -t feature/xyz
# With stash
g-co -t main --stash-changesThe command will automatically:
--stash-changes flag is providedPull changes from a remote branch.
g-pull - pull changes from remote branch
g-pull [options]
options:
-h, --help show brief help
--target-branch BRANCH, --target-branch=BRANCH, -t=BRANCH, -t BRANCH specify the target branch
--stash-changes stash changes before proceeding
-f, --fetch fetch changes before pullingUsage examples:
# Pull current branch
g-pull
# Pull specific branch with fetch
g-pull -t develop -fThe command will automatically:
-f/--fetch flag is providedPush changes to a remote branch, optionally with force.
g-push - push changes to remote branch
g-push [options]
options:
-h, --help show brief help
--target-branch BRANCH, --target-branch=BRANCH, -t=BRANCH, -t BRANCH specify the target branch
--stash-changes stash changes before proceeding
--force force push changes to the target branchUsage examples:
# Push current branch
g-push
# Force push
g-push --forceWarning: Using --force will overwrite remote history. This can cause data loss for collaborators who have already pulled the branch. Only use force push when you're certain it's safe.
The command will automatically:
--force flag is provided (use with caution)Create a new git worktree with intelligent repository restructuring. On first use, automatically reorganizes your repository to support multiple worktrees. New branches are created from your current branch, preserving your branch context.
g-wa - create git worktree for branch
g-wa [options]
options:
-h, --help show brief help
--target-branch BRANCH, --target-branch=BRANCH, -t=BRANCH, -t BRANCH specify the target branch
--stash-changes stash changes before proceedingUsage examples:
# Create worktree for branch (creates ../worktrees/feature_new_feature)
# If you're on develop, the new branch will be cut from develop
g-wa -t feature/new-feature
# With stash (creates ../worktrees/develop)
g-wa -t develop --stash-changesRepository Restructuring: On first use, g-wa will automatically reorganize your repository:
main/ subdirectoryworktrees/ directory for feature branchesFinal structure:
your-repo/
├── main/ # Default branch (main/master)
└── worktrees/ # Feature branch worktrees
├── feature_1/
├── feature_2/
└── bugfix_abc/The command will automatically:
main/ subdirectoryworktrees/ directory structure_)/Users/you/projects/your-repo/worktrees/feature_name)feature/this-is-a-very-long-branch-name → feature_this_is_a_very_long_br..)--stash-changes flagBranch Context: When creating a new branch, it will be cut from your current branch. For example, if you're on develop and run g-wa -t feature/new, the new branch will be created from develop, not from main. This ensures your new branch inherits the correct context.
Remove a git worktree by branch name or worktree directory name.
g-wr - remove a git worktree for a specified branch or name
g-wr [options]
options:
-h, --help show brief help
--target-branch BRANCH, --target-branch=BRANCH, -t=BRANCH, -t BRANCH specify the target branch
--worktree-name NAME, --worktree-name=NAME, -w=NAME, -w NAME specify the worktree directory nameUsage examples:
# Remove by branch name
g-wr -t feature/old-feature
# Remove by sanitized worktree directory name
g-wr -w feature_old_featureThe command will automatically:
Delete a branch locally and optionally push the deletion to remote.
g-db - delete a branch locally and optionally on remote
g-db [options]
options:
-h, --help show brief help
--target-branch BRANCH, --target-branch=BRANCH, -t=BRANCH, -t BRANCH specify the branch to deleteUsage examples:
# Delete branch (prompts for remote deletion)
g-db -t feature/completedThe command will automatically:
Discard the last commit with optional force mode.
g-dlc - discard the last commit
g-dlc [options]
options:
-h, --help show brief help
-f, --force force discard without checking uncommitted changesUsage examples:
# Discard last commit (soft reset)
g-dlc
# Force discard (hard reset)
g-dlc --forceWarning: Using --force performs a hard reset, permanently discarding all uncommitted changes in your working directory. This action cannot be undone.
The command will automatically:
--force is used)--force flagClear your working directory by stashing all changes with a timestamped message.
g-rmf - clear your working directory by stashing changes
g-rmf [options]
options:
-h, --help show brief help
--message MESSAGE, --message=MESSAGE, -m=MESSAGE, -m MESSAGE specify custom message for stashUsage examples:
# Stash with auto-generated message
g-rmf
# Stash with custom message
g-rmf -m "WIP: refactoring"The command will automatically:
Reset your working directory hard to the latest remote branch, stashing changes beforehand.
g-rto - reset to remote branch
g-rto [options]
options:
-h, --help show brief helpUsage examples:
# Reset current branch to remote
g-rtoThe command will automatically:
Display the current git branch name.
g-cb - show current branch name
g-cb [options]
options:
-h, --help show brief helpUsage examples:
# Show current branch (copies to clipboard)
g-cbThe command will automatically:
Show the output of git status.
g-s - show git status
g-s [options]
options:
-h, --help show brief helpUsage examples:
# Show git status
g-sThe command will automatically:
Compare and show differences between two branches.
g-diff - compare changes between two git branches
g-diff [options]
options:
-h, --help show brief help
--target-branch BRANCH, --target-branch=BRANCH, -t=BRANCH, -t BRANCH specify the target branch
--source-branch BRANCH, --source-branch=BRANCH, -s=BRANCH, -s BRANCH specify the source branch (defaults to current branch)
-f, --full show full diff and copy to clipboard
--files-only show only file names (no stats, no clipboard)Usage examples:
# Compare current branch with target (shows stats, copies stats to clipboard)
g-diff -t main
# Compare two branches
g-diff -s feature/a -t feature/b
# Show only file names (no stats, no clipboard)
g-diff -t main --files-only
# Full diff (copies formatted diff to clipboard)
g-diff -t main --fullThe command will automatically:
Default mode (no flags):
Example clipboard content:
src/components/Button.tsx | 23 ++++++---------
src/utils/helper.ts | 4 ++--
src/pages/index.tsx | 15 +++++++++++
3 files changed, 28 insertions(+), 13 deletions(-)With --files-only:
Example output:
src/components/Button.tsx
src/utils/helper.ts
src/pages/index.tsxWith --full:
Example clipboard content:
file: src/components/Button.tsx
stats: +15 -8
changes:
@@ -10,7 +10,9 @@ export function Button() {
- const handleClick = () => {
- console.log('clicked');
- };
+ const handleClick = useCallback(() => {
+ console.log('Button clicked');
+ onAction();
+ }, [onAction]);
file: src/utils/helper.ts
stats: +3 -1
changes:
@@ -5,7 +5,9 @@ export function formatDate() {
- return new Date().toISOString();
+ return new Date().toLocaleString('en-US', {
+ dateStyle: 'medium'
+ });Checkout to a branch, with optional stash.
1g-co - attempt to checkout to branch
2
3g-co [options]
4
5options:
6-h, --help show brief help
7--target-branch BRANCH, --target-branch=BRANCH, -t=BRANCH, -t BRANCH specify the target branch
8--stash-changes stash changes before proceedingUsage examples:
1# Checkout to a branch
2g-co -t feature/xyz
3
4# With stash
5g-co -t main --stash-changesThe command will automatically:
--stash-changes flag is provided1g-co - attempt to checkout to branch
2
3g-co [options]
4
5options:
6-h, --help show brief help
7--target-branch BRANCH, --target-branch=BRANCH, -t=BRANCH, -t BRANCH specify the target branch
8--stash-changes stash changes before proceeding1# Checkout to a branch
2g-co -t feature/xyz
3
4# With stash
5g-co -t main --stash-changesPull changes from a remote branch.
1g-pull - pull changes from remote branch
2
3g-pull [options]
4
5options:
6-h, --help show brief help
7--target-branch BRANCH, --target-branch=BRANCH, -t=BRANCH, -t BRANCH specify the target branch
8--stash-changes stash changes before proceeding
9-f, --fetch fetch changes before pullingUsage examples:
1# Pull current branch
2g-pull
3
4# Pull specific branch with fetch
5g-pull -t develop -fThe command will automatically:
-f/--fetch flag is provided1g-pull - pull changes from remote branch
2
3g-pull [options]
4
5options:
6-h, --help show brief help
7--target-branch BRANCH, --target-branch=BRANCH, -t=BRANCH, -t BRANCH specify the target branch
8--stash-changes stash changes before proceeding
9-f, --fetch fetch changes before pulling1# Pull current branch
2g-pull
3
4# Pull specific branch with fetch
5g-pull -t develop -fPush changes to a remote branch, optionally with force.
1g-push - push changes to remote branch
2
3g-push [options]
4
5options:
6-h, --help show brief help
7--target-branch BRANCH, --target-branch=BRANCH, -t=BRANCH, -t BRANCH specify the target branch
8--stash-changes stash changes before proceeding
9--force force push changes to the target branchUsage examples:
1# Push current branch
2g-push
3
4# Force push
5g-push --forceWarning: Using --force will overwrite remote history. This can cause data loss for collaborators who have already pulled the branch. Only use force push when you're certain it's safe.
The command will automatically:
--force flag is provided (use with caution)1g-push - push changes to remote branch
2
3g-push [options]
4
5options:
6-h, --help show brief help
7--target-branch BRANCH, --target-branch=BRANCH, -t=BRANCH, -t BRANCH specify the target branch
8--stash-changes stash changes before proceeding
9--force force push changes to the target branch1# Push current branch
2g-push
3
4# Force push
5g-push --forceCreate a new git worktree with intelligent repository restructuring. On first use, automatically reorganizes your repository to support multiple worktrees. New branches are created from your current branch, preserving your branch context.
1g-wa - create git worktree for branch
2
3g-wa [options]
4
5options:
6-h, --help show brief help
7--target-branch BRANCH, --target-branch=BRANCH, -t=BRANCH, -t BRANCH specify the target branch
8--stash-changes stash changes before proceedingUsage examples:
1# Create worktree for branch (creates ../worktrees/feature_new_feature)
2# If you're on develop, the new branch will be cut from develop
3g-wa -t feature/new-feature
4
5# With stash (creates ../worktrees/develop)
6g-wa -t develop --stash-changesRepository Restructuring: On first use, g-wa will automatically reorganize your repository:
main/ subdirectoryworktrees/ directory for feature branchesFinal structure:
your-repo/
├── main/ # Default branch (main/master)
└── worktrees/ # Feature branch worktrees
├── feature_1/
├── feature_2/
└── bugfix_abc/The command will automatically:
main/ subdirectoryworktrees/ directory structure_)/Users/you/projects/your-repo/worktrees/feature_name)feature/this-is-a-very-long-branch-name → feature_this_is_a_very_long_br..)--stash-changes flagBranch Context: When creating a new branch, it will be cut from your current branch. For example, if you're on develop and run g-wa -t feature/new, the new branch will be created from develop, not from main. This ensures your new branch inherits the correct context.
1g-wa - create git worktree for branch
2
3g-wa [options]
4
5options:
6-h, --help show brief help
7--target-branch BRANCH, --target-branch=BRANCH, -t=BRANCH, -t BRANCH specify the target branch
8--stash-changes stash changes before proceeding1# Create worktree for branch (creates ../worktrees/feature_new_feature)
2# If you're on develop, the new branch will be cut from develop
3g-wa -t feature/new-feature
4
5# With stash (creates ../worktrees/develop)
6g-wa -t develop --stash-changes1your-repo/
2├── main/ # Default branch (main/master)
3└── worktrees/ # Feature branch worktrees
4 ├── feature_1/
5 ├── feature_2/
6 └── bugfix_abc/Remove a git worktree by branch name or worktree directory name.
1g-wr - remove a git worktree for a specified branch or name
2
3g-wr [options]
4
5options:
6-h, --help show brief help
7--target-branch BRANCH, --target-branch=BRANCH, -t=BRANCH, -t BRANCH specify the target branch
8--worktree-name NAME, --worktree-name=NAME, -w=NAME, -w NAME specify the worktree directory nameUsage examples:
1# Remove by branch name
2g-wr -t feature/old-feature
3
4# Remove by sanitized worktree directory name
5g-wr -w feature_old_featureThe command will automatically:
1g-wr - remove a git worktree for a specified branch or name
2
3g-wr [options]
4
5options:
6-h, --help show brief help
7--target-branch BRANCH, --target-branch=BRANCH, -t=BRANCH, -t BRANCH specify the target branch
8--worktree-name NAME, --worktree-name=NAME, -w=NAME, -w NAME specify the worktree directory name1# Remove by branch name
2g-wr -t feature/old-feature
3
4# Remove by sanitized worktree directory name
5g-wr -w feature_old_featureDelete a branch locally and optionally push the deletion to remote.
1g-db - delete a branch locally and optionally on remote
2
3g-db [options]
4
5options:
6-h, --help show brief help
7--target-branch BRANCH, --target-branch=BRANCH, -t=BRANCH, -t BRANCH specify the branch to deleteUsage examples:
1# Delete branch (prompts for remote deletion)
2g-db -t feature/completedThe command will automatically:
1g-db - delete a branch locally and optionally on remote
2
3g-db [options]
4
5options:
6-h, --help show brief help
7--target-branch BRANCH, --target-branch=BRANCH, -t=BRANCH, -t BRANCH specify the branch to delete1# Delete branch (prompts for remote deletion)
2g-db -t feature/completedDiscard the last commit with optional force mode.
1g-dlc - discard the last commit
2
3g-dlc [options]
4
5options:
6-h, --help show brief help
7-f, --force force discard without checking uncommitted changesUsage examples:
1# Discard last commit (soft reset)
2g-dlc
3
4# Force discard (hard reset)
5g-dlc --forceWarning: Using --force performs a hard reset, permanently discarding all uncommitted changes in your working directory. This action cannot be undone.
The command will automatically:
--force is used)--force flag1g-dlc - discard the last commit
2
3g-dlc [options]
4
5options:
6-h, --help show brief help
7-f, --force force discard without checking uncommitted changes1# Discard last commit (soft reset)
2g-dlc
3
4# Force discard (hard reset)
5g-dlc --forceClear your working directory by stashing all changes with a timestamped message.
1g-rmf - clear your working directory by stashing changes
2
3g-rmf [options]
4
5options:
6-h, --help show brief help
7--message MESSAGE, --message=MESSAGE, -m=MESSAGE, -m MESSAGE specify custom message for stashUsage examples:
1# Stash with auto-generated message
2g-rmf
3
4# Stash with custom message
5g-rmf -m "WIP: refactoring"The command will automatically:
1g-rmf - clear your working directory by stashing changes
2
3g-rmf [options]
4
5options:
6-h, --help show brief help
7--message MESSAGE, --message=MESSAGE, -m=MESSAGE, -m MESSAGE specify custom message for stash1# Stash with auto-generated message
2g-rmf
3
4# Stash with custom message
5g-rmf -m "WIP: refactoring"Reset your working directory hard to the latest remote branch, stashing changes beforehand.
1g-rto - reset to remote branch
2
3g-rto [options]
4
5options:
6-h, --help show brief helpUsage examples:
1# Reset current branch to remote
2g-rtoThe command will automatically:
1g-rto - reset to remote branch
2
3g-rto [options]
4
5options:
6-h, --help show brief help1# Reset current branch to remote
2g-rtoDisplay the current git branch name.
1g-cb - show current branch name
2
3g-cb [options]
4
5options:
6-h, --help show brief helpUsage examples:
1# Show current branch (copies to clipboard)
2g-cbThe command will automatically:
1g-cb - show current branch name
2
3g-cb [options]
4
5options:
6-h, --help show brief help1# Show current branch (copies to clipboard)
2g-cbShow the output of git status.
1g-s - show git status
2
3g-s [options]
4
5options:
6-h, --help show brief helpUsage examples:
1# Show git status
2g-sThe command will automatically:
1g-s - show git status
2
3g-s [options]
4
5options:
6-h, --help show brief help1# Show git status
2g-sCompare and show differences between two branches.
1g-diff - compare changes between two git branches
2
3g-diff [options]
4
5options:
6-h, --help show brief help
7--target-branch BRANCH, --target-branch=BRANCH, -t=BRANCH, -t BRANCH specify the target branch
8--source-branch BRANCH, --source-branch=BRANCH, -s=BRANCH, -s BRANCH specify the source branch (defaults to current branch)
9-f, --full show full diff and copy to clipboard
10--files-only show only file names (no stats, no clipboard)Usage examples:
# Compare current branch with target (shows stats, copies stats to clipboard)
g-diff -t main
# Compare two branches
g-diff -s feature/a -t feature/b
# Show only file names (no stats, no clipboard)
g-diff -t main --files-only
# Full diff (copies formatted diff to clipboard)
g-diff -t main --fullThe command will automatically:
Default mode (no flags):
Example clipboard content:
src/components/Button.tsx | 23 ++++++---------
src/utils/helper.ts | 4 ++--
src/pages/index.tsx | 15 +++++++++++
3 files changed, 28 insertions(+), 13 deletions(-)With --files-only:
Example output:
1src/components/Button.tsx
2src/utils/helper.ts
3src/pages/index.tsxWith --full:
Example clipboard content:
file: src/components/Button.tsx
stats: +15 -8
changes:
@@ -10,7 +10,9 @@ export function Button() {
- const handleClick = () => {
- console.log('clicked');
- };
+ const handleClick = useCallback(() => {
+ console.log('Button clicked');
+ onAction();
+ }, [onAction]);
file: src/utils/helper.ts
stats: +3 -1
changes:
@@ -5,7 +5,9 @@ export function formatDate() {
- return new Date().toISOString();
+ return new Date().toLocaleString('en-US', {
+ dateStyle: 'medium'
+ });1g-diff - compare changes between two git branches
2
3g-diff [options]
4
5options:
6-h, --help show brief help
7--target-branch BRANCH, --target-branch=BRANCH, -t=BRANCH, -t BRANCH specify the target branch
8--source-branch BRANCH, --source-branch=BRANCH, -s=BRANCH, -s BRANCH specify the source branch (defaults to current branch)
9-f, --full show full diff and copy to clipboard
10--files-only show only file names (no stats, no clipboard)1# Compare current branch with target (shows stats, copies stats to clipboard)
2g-diff -t main
3
4# Compare two branches
5g-diff -s feature/a -t feature/b
6
7# Show only file names (no stats, no clipboard)
8g-diff -t main --files-only
9
10# Full diff (copies formatted diff to clipboard)
11g-diff -t main --full1src/components/Button.tsx | 23 ++++++---------
2src/utils/helper.ts | 4 ++--
3src/pages/index.tsx | 15 +++++++++++
43 files changed, 28 insertions(+), 13 deletions(-)1src/components/Button.tsx
2src/utils/helper.ts
3src/pages/index.tsx1file: src/components/Button.tsx
2stats: +15 -8
3changes:
4
5 @@ -10,7 +10,9 @@ export function Button() {
6 - const handleClick = () => {
7 - console.log('clicked');
8 - };
9 + const handleClick = useCallback(() => {
10 + console.log('Button clicked');
11 + onAction();
12 + }, [onAction]);
13
14file: src/utils/helper.ts
15stats: +3 -1
16changes:
17
18 @@ -5,7 +5,9 @@ export function formatDate() {
19 - return new Date().toISOString();
20 + return new Date().toLocaleString('en-US', {
21 + dateStyle: 'medium'
22 + });Contributions are welcome! Please fork the repository and submit pull requests. For bugs or feature requests, open an issue on the repository.
View source code, report issues, and contributeGitsy is a set of versatile bash utilities designed to make managing Git repositories easier, faster, and more efficient. It provides user-friendly commands to automate common Git operations such as checking out branches, pushing, pulling, creating worktrees, stashing changes, and viewing git status — all enhanced with helpful prompts, color-coded outputs, and automation.
g-co--target-branch, --stash-changesg-pull--target-branch, --fetchg-push--target-branch, --forceg-wa--target-branch, --stash-changesg-wr--target-branch, --worktree-nameg-db--target-branchg-dlc--forceg-rmf--messageg-rtog-cbg-sg-diff--source-branch, --target-branch, --full, --files-onlyg-cog-pullg-pushg-wag-wrg-dbg-dlcg-rmfg-rtog-cbg-sg-diffInstall gitsy globally using npm. You'll also need to install the required dependencies (git, figlet, lolcat) for your platform:
1# Install globally via npm
2npm install -g gitsy
3
4# Install dependencies (required)
5# macOS
6brew install git figlet lolcat
7
8# Ubuntu/Debian
9sudo apt-get install git figlet lolcat
10
11# Fedora/RHEL
12sudo dnf install git figlet lolcat
13
14# Verify installation
15g-s --helpOnce installed, all commands (g-s, g-co, g-pull, etc.) will be available globally in your terminal.
1# Install globally via npm
2npm install -g gitsy
3
4# Install dependencies (required)
5# macOS
6brew install git figlet lolcat
7
8# Ubuntu/Debian
9sudo apt-get install git figlet lolcat
10
11# Fedora/RHEL
12sudo dnf install git figlet lolcat
13
14# Verify installation
15g-s --helpEach script corresponds to a Git-related utility. Below is a comprehensive guide on all available commands.
Checkout to a branch, with optional stash.
g-co - attempt to checkout to branch
g-co [options]
options:
-h, --help show brief help
--target-branch BRANCH, --target-branch=BRANCH, -t=BRANCH, -t BRANCH specify the target branch
--stash-changes stash changes before proceedingUsage examples:
# Checkout to a branch
g-co -t feature/xyz
# With stash
g-co -t main --stash-changesThe command will automatically:
--stash-changes flag is providedPull changes from a remote branch.
g-pull - pull changes from remote branch
g-pull [options]
options:
-h, --help show brief help
--target-branch BRANCH, --target-branch=BRANCH, -t=BRANCH, -t BRANCH specify the target branch
--stash-changes stash changes before proceeding
-f, --fetch fetch changes before pullingUsage examples:
# Pull current branch
g-pull
# Pull specific branch with fetch
g-pull -t develop -fThe command will automatically:
-f/--fetch flag is providedPush changes to a remote branch, optionally with force.
g-push - push changes to remote branch
g-push [options]
options:
-h, --help show brief help
--target-branch BRANCH, --target-branch=BRANCH, -t=BRANCH, -t BRANCH specify the target branch
--stash-changes stash changes before proceeding
--force force push changes to the target branchUsage examples:
# Push current branch
g-push
# Force push
g-push --forceWarning: Using --force will overwrite remote history. This can cause data loss for collaborators who have already pulled the branch. Only use force push when you're certain it's safe.
The command will automatically:
--force flag is provided (use with caution)Create a new git worktree with intelligent repository restructuring. On first use, automatically reorganizes your repository to support multiple worktrees. New branches are created from your current branch, preserving your branch context.
g-wa - create git worktree for branch
g-wa [options]
options:
-h, --help show brief help
--target-branch BRANCH, --target-branch=BRANCH, -t=BRANCH, -t BRANCH specify the target branch
--stash-changes stash changes before proceedingUsage examples:
# Create worktree for branch (creates ../worktrees/feature_new_feature)
# If you're on develop, the new branch will be cut from develop
g-wa -t feature/new-feature
# With stash (creates ../worktrees/develop)
g-wa -t develop --stash-changesRepository Restructuring: On first use, g-wa will automatically reorganize your repository:
main/ subdirectoryworktrees/ directory for feature branchesFinal structure:
your-repo/
├── main/ # Default branch (main/master)
└── worktrees/ # Feature branch worktrees
├── feature_1/
├── feature_2/
└── bugfix_abc/The command will automatically:
main/ subdirectoryworktrees/ directory structure_)/Users/you/projects/your-repo/worktrees/feature_name)feature/this-is-a-very-long-branch-name → feature_this_is_a_very_long_br..)--stash-changes flagBranch Context: When creating a new branch, it will be cut from your current branch. For example, if you're on develop and run g-wa -t feature/new, the new branch will be created from develop, not from main. This ensures your new branch inherits the correct context.
Remove a git worktree by branch name or worktree directory name.
g-wr - remove a git worktree for a specified branch or name
g-wr [options]
options:
-h, --help show brief help
--target-branch BRANCH, --target-branch=BRANCH, -t=BRANCH, -t BRANCH specify the target branch
--worktree-name NAME, --worktree-name=NAME, -w=NAME, -w NAME specify the worktree directory nameUsage examples:
# Remove by branch name
g-wr -t feature/old-feature
# Remove by sanitized worktree directory name
g-wr -w feature_old_featureThe command will automatically:
Delete a branch locally and optionally push the deletion to remote.
g-db - delete a branch locally and optionally on remote
g-db [options]
options:
-h, --help show brief help
--target-branch BRANCH, --target-branch=BRANCH, -t=BRANCH, -t BRANCH specify the branch to deleteUsage examples:
# Delete branch (prompts for remote deletion)
g-db -t feature/completedThe command will automatically:
Discard the last commit with optional force mode.
g-dlc - discard the last commit
g-dlc [options]
options:
-h, --help show brief help
-f, --force force discard without checking uncommitted changesUsage examples:
# Discard last commit (soft reset)
g-dlc
# Force discard (hard reset)
g-dlc --forceWarning: Using --force performs a hard reset, permanently discarding all uncommitted changes in your working directory. This action cannot be undone.
The command will automatically:
--force is used)--force flagClear your working directory by stashing all changes with a timestamped message.
g-rmf - clear your working directory by stashing changes
g-rmf [options]
options:
-h, --help show brief help
--message MESSAGE, --message=MESSAGE, -m=MESSAGE, -m MESSAGE specify custom message for stashUsage examples:
# Stash with auto-generated message
g-rmf
# Stash with custom message
g-rmf -m "WIP: refactoring"The command will automatically:
Reset your working directory hard to the latest remote branch, stashing changes beforehand.
g-rto - reset to remote branch
g-rto [options]
options:
-h, --help show brief helpUsage examples:
# Reset current branch to remote
g-rtoThe command will automatically:
Display the current git branch name.
g-cb - show current branch name
g-cb [options]
options:
-h, --help show brief helpUsage examples:
# Show current branch (copies to clipboard)
g-cbThe command will automatically:
Show the output of git status.
g-s - show git status
g-s [options]
options:
-h, --help show brief helpUsage examples:
# Show git status
g-sThe command will automatically:
Compare and show differences between two branches.
g-diff - compare changes between two git branches
g-diff [options]
options:
-h, --help show brief help
--target-branch BRANCH, --target-branch=BRANCH, -t=BRANCH, -t BRANCH specify the target branch
--source-branch BRANCH, --source-branch=BRANCH, -s=BRANCH, -s BRANCH specify the source branch (defaults to current branch)
-f, --full show full diff and copy to clipboard
--files-only show only file names (no stats, no clipboard)Usage examples:
# Compare current branch with target (shows stats, copies stats to clipboard)
g-diff -t main
# Compare two branches
g-diff -s feature/a -t feature/b
# Show only file names (no stats, no clipboard)
g-diff -t main --files-only
# Full diff (copies formatted diff to clipboard)
g-diff -t main --fullThe command will automatically:
Default mode (no flags):
Example clipboard content:
src/components/Button.tsx | 23 ++++++---------
src/utils/helper.ts | 4 ++--
src/pages/index.tsx | 15 +++++++++++
3 files changed, 28 insertions(+), 13 deletions(-)With --files-only:
Example output:
src/components/Button.tsx
src/utils/helper.ts
src/pages/index.tsxWith --full:
Example clipboard content:
file: src/components/Button.tsx
stats: +15 -8
changes:
@@ -10,7 +10,9 @@ export function Button() {
- const handleClick = () => {
- console.log('clicked');
- };
+ const handleClick = useCallback(() => {
+ console.log('Button clicked');
+ onAction();
+ }, [onAction]);
file: src/utils/helper.ts
stats: +3 -1
changes:
@@ -5,7 +5,9 @@ export function formatDate() {
- return new Date().toISOString();
+ return new Date().toLocaleString('en-US', {
+ dateStyle: 'medium'
+ });Checkout to a branch, with optional stash.
1g-co - attempt to checkout to branch
2
3g-co [options]
4
5options:
6-h, --help show brief help
7--target-branch BRANCH, --target-branch=BRANCH, -t=BRANCH, -t BRANCH specify the target branch
8--stash-changes stash changes before proceedingUsage examples:
1# Checkout to a branch
2g-co -t feature/xyz
3
4# With stash
5g-co -t main --stash-changesThe command will automatically:
--stash-changes flag is provided1g-co - attempt to checkout to branch
2
3g-co [options]
4
5options:
6-h, --help show brief help
7--target-branch BRANCH, --target-branch=BRANCH, -t=BRANCH, -t BRANCH specify the target branch
8--stash-changes stash changes before proceeding1# Checkout to a branch
2g-co -t feature/xyz
3
4# With stash
5g-co -t main --stash-changesPull changes from a remote branch.
1g-pull - pull changes from remote branch
2
3g-pull [options]
4
5options:
6-h, --help show brief help
7--target-branch BRANCH, --target-branch=BRANCH, -t=BRANCH, -t BRANCH specify the target branch
8--stash-changes stash changes before proceeding
9-f, --fetch fetch changes before pullingUsage examples:
1# Pull current branch
2g-pull
3
4# Pull specific branch with fetch
5g-pull -t develop -fThe command will automatically:
-f/--fetch flag is provided1g-pull - pull changes from remote branch
2
3g-pull [options]
4
5options:
6-h, --help show brief help
7--target-branch BRANCH, --target-branch=BRANCH, -t=BRANCH, -t BRANCH specify the target branch
8--stash-changes stash changes before proceeding
9-f, --fetch fetch changes before pulling1# Pull current branch
2g-pull
3
4# Pull specific branch with fetch
5g-pull -t develop -fPush changes to a remote branch, optionally with force.
1g-push - push changes to remote branch
2
3g-push [options]
4
5options:
6-h, --help show brief help
7--target-branch BRANCH, --target-branch=BRANCH, -t=BRANCH, -t BRANCH specify the target branch
8--stash-changes stash changes before proceeding
9--force force push changes to the target branchUsage examples:
1# Push current branch
2g-push
3
4# Force push
5g-push --forceWarning: Using --force will overwrite remote history. This can cause data loss for collaborators who have already pulled the branch. Only use force push when you're certain it's safe.
The command will automatically:
--force flag is provided (use with caution)1g-push - push changes to remote branch
2
3g-push [options]
4
5options:
6-h, --help show brief help
7--target-branch BRANCH, --target-branch=BRANCH, -t=BRANCH, -t BRANCH specify the target branch
8--stash-changes stash changes before proceeding
9--force force push changes to the target branch1# Push current branch
2g-push
3
4# Force push
5g-push --forceCreate a new git worktree with intelligent repository restructuring. On first use, automatically reorganizes your repository to support multiple worktrees. New branches are created from your current branch, preserving your branch context.
1g-wa - create git worktree for branch
2
3g-wa [options]
4
5options:
6-h, --help show brief help
7--target-branch BRANCH, --target-branch=BRANCH, -t=BRANCH, -t BRANCH specify the target branch
8--stash-changes stash changes before proceedingUsage examples:
1# Create worktree for branch (creates ../worktrees/feature_new_feature)
2# If you're on develop, the new branch will be cut from develop
3g-wa -t feature/new-feature
4
5# With stash (creates ../worktrees/develop)
6g-wa -t develop --stash-changesRepository Restructuring: On first use, g-wa will automatically reorganize your repository:
main/ subdirectoryworktrees/ directory for feature branchesFinal structure:
your-repo/
├── main/ # Default branch (main/master)
└── worktrees/ # Feature branch worktrees
├── feature_1/
├── feature_2/
└── bugfix_abc/The command will automatically:
main/ subdirectoryworktrees/ directory structure_)/Users/you/projects/your-repo/worktrees/feature_name)feature/this-is-a-very-long-branch-name → feature_this_is_a_very_long_br..)--stash-changes flagBranch Context: When creating a new branch, it will be cut from your current branch. For example, if you're on develop and run g-wa -t feature/new, the new branch will be created from develop, not from main. This ensures your new branch inherits the correct context.
1g-wa - create git worktree for branch
2
3g-wa [options]
4
5options:
6-h, --help show brief help
7--target-branch BRANCH, --target-branch=BRANCH, -t=BRANCH, -t BRANCH specify the target branch
8--stash-changes stash changes before proceeding1# Create worktree for branch (creates ../worktrees/feature_new_feature)
2# If you're on develop, the new branch will be cut from develop
3g-wa -t feature/new-feature
4
5# With stash (creates ../worktrees/develop)
6g-wa -t develop --stash-changes1your-repo/
2├── main/ # Default branch (main/master)
3└── worktrees/ # Feature branch worktrees
4 ├── feature_1/
5 ├── feature_2/
6 └── bugfix_abc/Remove a git worktree by branch name or worktree directory name.
1g-wr - remove a git worktree for a specified branch or name
2
3g-wr [options]
4
5options:
6-h, --help show brief help
7--target-branch BRANCH, --target-branch=BRANCH, -t=BRANCH, -t BRANCH specify the target branch
8--worktree-name NAME, --worktree-name=NAME, -w=NAME, -w NAME specify the worktree directory nameUsage examples:
1# Remove by branch name
2g-wr -t feature/old-feature
3
4# Remove by sanitized worktree directory name
5g-wr -w feature_old_featureThe command will automatically:
1g-wr - remove a git worktree for a specified branch or name
2
3g-wr [options]
4
5options:
6-h, --help show brief help
7--target-branch BRANCH, --target-branch=BRANCH, -t=BRANCH, -t BRANCH specify the target branch
8--worktree-name NAME, --worktree-name=NAME, -w=NAME, -w NAME specify the worktree directory name1# Remove by branch name
2g-wr -t feature/old-feature
3
4# Remove by sanitized worktree directory name
5g-wr -w feature_old_featureDelete a branch locally and optionally push the deletion to remote.
1g-db - delete a branch locally and optionally on remote
2
3g-db [options]
4
5options:
6-h, --help show brief help
7--target-branch BRANCH, --target-branch=BRANCH, -t=BRANCH, -t BRANCH specify the branch to deleteUsage examples:
1# Delete branch (prompts for remote deletion)
2g-db -t feature/completedThe command will automatically:
1g-db - delete a branch locally and optionally on remote
2
3g-db [options]
4
5options:
6-h, --help show brief help
7--target-branch BRANCH, --target-branch=BRANCH, -t=BRANCH, -t BRANCH specify the branch to delete1# Delete branch (prompts for remote deletion)
2g-db -t feature/completedDiscard the last commit with optional force mode.
1g-dlc - discard the last commit
2
3g-dlc [options]
4
5options:
6-h, --help show brief help
7-f, --force force discard without checking uncommitted changesUsage examples:
1# Discard last commit (soft reset)
2g-dlc
3
4# Force discard (hard reset)
5g-dlc --forceWarning: Using --force performs a hard reset, permanently discarding all uncommitted changes in your working directory. This action cannot be undone.
The command will automatically:
--force is used)--force flag1g-dlc - discard the last commit
2
3g-dlc [options]
4
5options:
6-h, --help show brief help
7-f, --force force discard without checking uncommitted changes1# Discard last commit (soft reset)
2g-dlc
3
4# Force discard (hard reset)
5g-dlc --forceClear your working directory by stashing all changes with a timestamped message.
1g-rmf - clear your working directory by stashing changes
2
3g-rmf [options]
4
5options:
6-h, --help show brief help
7--message MESSAGE, --message=MESSAGE, -m=MESSAGE, -m MESSAGE specify custom message for stashUsage examples:
1# Stash with auto-generated message
2g-rmf
3
4# Stash with custom message
5g-rmf -m "WIP: refactoring"The command will automatically:
1g-rmf - clear your working directory by stashing changes
2
3g-rmf [options]
4
5options:
6-h, --help show brief help
7--message MESSAGE, --message=MESSAGE, -m=MESSAGE, -m MESSAGE specify custom message for stash1# Stash with auto-generated message
2g-rmf
3
4# Stash with custom message
5g-rmf -m "WIP: refactoring"Reset your working directory hard to the latest remote branch, stashing changes beforehand.
1g-rto - reset to remote branch
2
3g-rto [options]
4
5options:
6-h, --help show brief helpUsage examples:
1# Reset current branch to remote
2g-rtoThe command will automatically:
1g-rto - reset to remote branch
2
3g-rto [options]
4
5options:
6-h, --help show brief help1# Reset current branch to remote
2g-rtoDisplay the current git branch name.
1g-cb - show current branch name
2
3g-cb [options]
4
5options:
6-h, --help show brief helpUsage examples:
1# Show current branch (copies to clipboard)
2g-cbThe command will automatically:
1g-cb - show current branch name
2
3g-cb [options]
4
5options:
6-h, --help show brief help1# Show current branch (copies to clipboard)
2g-cbShow the output of git status.
1g-s - show git status
2
3g-s [options]
4
5options:
6-h, --help show brief helpUsage examples:
1# Show git status
2g-sThe command will automatically:
1g-s - show git status
2
3g-s [options]
4
5options:
6-h, --help show brief help1# Show git status
2g-sCompare and show differences between two branches.
1g-diff - compare changes between two git branches
2
3g-diff [options]
4
5options:
6-h, --help show brief help
7--target-branch BRANCH, --target-branch=BRANCH, -t=BRANCH, -t BRANCH specify the target branch
8--source-branch BRANCH, --source-branch=BRANCH, -s=BRANCH, -s BRANCH specify the source branch (defaults to current branch)
9-f, --full show full diff and copy to clipboard
10--files-only show only file names (no stats, no clipboard)Usage examples:
# Compare current branch with target (shows stats, copies stats to clipboard)
g-diff -t main
# Compare two branches
g-diff -s feature/a -t feature/b
# Show only file names (no stats, no clipboard)
g-diff -t main --files-only
# Full diff (copies formatted diff to clipboard)
g-diff -t main --fullThe command will automatically:
Default mode (no flags):
Example clipboard content:
src/components/Button.tsx | 23 ++++++---------
src/utils/helper.ts | 4 ++--
src/pages/index.tsx | 15 +++++++++++
3 files changed, 28 insertions(+), 13 deletions(-)With --files-only:
Example output:
1src/components/Button.tsx
2src/utils/helper.ts
3src/pages/index.tsxWith --full:
Example clipboard content:
file: src/components/Button.tsx
stats: +15 -8
changes:
@@ -10,7 +10,9 @@ export function Button() {
- const handleClick = () => {
- console.log('clicked');
- };
+ const handleClick = useCallback(() => {
+ console.log('Button clicked');
+ onAction();
+ }, [onAction]);
file: src/utils/helper.ts
stats: +3 -1
changes:
@@ -5,7 +5,9 @@ export function formatDate() {
- return new Date().toISOString();
+ return new Date().toLocaleString('en-US', {
+ dateStyle: 'medium'
+ });1g-diff - compare changes between two git branches
2
3g-diff [options]
4
5options:
6-h, --help show brief help
7--target-branch BRANCH, --target-branch=BRANCH, -t=BRANCH, -t BRANCH specify the target branch
8--source-branch BRANCH, --source-branch=BRANCH, -s=BRANCH, -s BRANCH specify the source branch (defaults to current branch)
9-f, --full show full diff and copy to clipboard
10--files-only show only file names (no stats, no clipboard)1# Compare current branch with target (shows stats, copies stats to clipboard)
2g-diff -t main
3
4# Compare two branches
5g-diff -s feature/a -t feature/b
6
7# Show only file names (no stats, no clipboard)
8g-diff -t main --files-only
9
10# Full diff (copies formatted diff to clipboard)
11g-diff -t main --full1src/components/Button.tsx | 23 ++++++---------
2src/utils/helper.ts | 4 ++--
3src/pages/index.tsx | 15 +++++++++++
43 files changed, 28 insertions(+), 13 deletions(-)1src/components/Button.tsx
2src/utils/helper.ts
3src/pages/index.tsx1file: src/components/Button.tsx
2stats: +15 -8
3changes:
4
5 @@ -10,7 +10,9 @@ export function Button() {
6 - const handleClick = () => {
7 - console.log('clicked');
8 - };
9 + const handleClick = useCallback(() => {
10 + console.log('Button clicked');
11 + onAction();
12 + }, [onAction]);
13
14file: src/utils/helper.ts
15stats: +3 -1
16changes:
17
18 @@ -5,7 +5,9 @@ export function formatDate() {
19 - return new Date().toISOString();
20 + return new Date().toLocaleString('en-US', {
21 + dateStyle: 'medium'
22 + });Contributions are welcome! Please fork the repository and submit pull requests. For bugs or feature requests, open an issue on the repository.
View source code, report issues, and contributeCheckout to a branch, with optional stash.
1g-co - attempt to checkout to branch
2
3g-co [options]
4
5options:
6-h, --help show brief help
7--target-branch BRANCH, --target-branch=BRANCH, -t=BRANCH, -t BRANCH specify the target branch
8--stash-changes stash changes before proceedingUsage examples:
1# Checkout to a branch
2g-co -t feature/xyz
3
4# With stash
5g-co -t main --stash-changesThe command will automatically:
--stash-changes flag is provided1g-co - attempt to checkout to branch
2
3g-co [options]
4
5options:
6-h, --help show brief help
7--target-branch BRANCH, --target-branch=BRANCH, -t=BRANCH, -t BRANCH specify the target branch
8--stash-changes stash changes before proceeding1# Checkout to a branch
2g-co -t feature/xyz
3
4# With stash
5g-co -t main --stash-changesPull changes from a remote branch.
1g-pull - pull changes from remote branch
2
3g-pull [options]
4
5options:
6-h, --help show brief help
7--target-branch BRANCH, --target-branch=BRANCH, -t=BRANCH, -t BRANCH specify the target branch
8--stash-changes stash changes before proceeding
9-f, --fetch fetch changes before pullingUsage examples:
1# Pull current branch
2g-pull
3
4# Pull specific branch with fetch
5g-pull -t develop -fThe command will automatically:
-f/--fetch flag is provided1g-pull - pull changes from remote branch
2
3g-pull [options]
4
5options:
6-h, --help show brief help
7--target-branch BRANCH, --target-branch=BRANCH, -t=BRANCH, -t BRANCH specify the target branch
8--stash-changes stash changes before proceeding
9-f, --fetch fetch changes before pulling1# Pull current branch
2g-pull
3
4# Pull specific branch with fetch
5g-pull -t develop -fPush changes to a remote branch, optionally with force.
1g-push - push changes to remote branch
2
3g-push [options]
4
5options:
6-h, --help show brief help
7--target-branch BRANCH, --target-branch=BRANCH, -t=BRANCH, -t BRANCH specify the target branch
8--stash-changes stash changes before proceeding
9--force force push changes to the target branchUsage examples:
1# Push current branch
2g-push
3
4# Force push
5g-push --forceWarning: Using --force will overwrite remote history. This can cause data loss for collaborators who have already pulled the branch. Only use force push when you're certain it's safe.
The command will automatically:
--force flag is provided (use with caution)1g-push - push changes to remote branch
2
3g-push [options]
4
5options:
6-h, --help show brief help
7--target-branch BRANCH, --target-branch=BRANCH, -t=BRANCH, -t BRANCH specify the target branch
8--stash-changes stash changes before proceeding
9--force force push changes to the target branch1# Push current branch
2g-push
3
4# Force push
5g-push --forceCreate a new git worktree with intelligent repository restructuring. On first use, automatically reorganizes your repository to support multiple worktrees. New branches are created from your current branch, preserving your branch context.
1g-wa - create git worktree for branch
2
3g-wa [options]
4
5options:
6-h, --help show brief help
7--target-branch BRANCH, --target-branch=BRANCH, -t=BRANCH, -t BRANCH specify the target branch
8--stash-changes stash changes before proceedingUsage examples:
1# Create worktree for branch (creates ../worktrees/feature_new_feature)
2# If you're on develop, the new branch will be cut from develop
3g-wa -t feature/new-feature
4
5# With stash (creates ../worktrees/develop)
6g-wa -t develop --stash-changesRepository Restructuring: On first use, g-wa will automatically reorganize your repository:
main/ subdirectoryworktrees/ directory for feature branchesFinal structure:
your-repo/
├── main/ # Default branch (main/master)
└── worktrees/ # Feature branch worktrees
├── feature_1/
├── feature_2/
└── bugfix_abc/The command will automatically:
main/ subdirectoryworktrees/ directory structure_)/Users/you/projects/your-repo/worktrees/feature_name)feature/this-is-a-very-long-branch-name → feature_this_is_a_very_long_br..)--stash-changes flagBranch Context: When creating a new branch, it will be cut from your current branch. For example, if you're on develop and run g-wa -t feature/new, the new branch will be created from develop, not from main. This ensures your new branch inherits the correct context.
1g-wa - create git worktree for branch
2
3g-wa [options]
4
5options:
6-h, --help show brief help
7--target-branch BRANCH, --target-branch=BRANCH, -t=BRANCH, -t BRANCH specify the target branch
8--stash-changes stash changes before proceeding1# Create worktree for branch (creates ../worktrees/feature_new_feature)
2# If you're on develop, the new branch will be cut from develop
3g-wa -t feature/new-feature
4
5# With stash (creates ../worktrees/develop)
6g-wa -t develop --stash-changes1your-repo/
2├── main/ # Default branch (main/master)
3└── worktrees/ # Feature branch worktrees
4 ├── feature_1/
5 ├── feature_2/
6 └── bugfix_abc/Remove a git worktree by branch name or worktree directory name.
1g-wr - remove a git worktree for a specified branch or name
2
3g-wr [options]
4
5options:
6-h, --help show brief help
7--target-branch BRANCH, --target-branch=BRANCH, -t=BRANCH, -t BRANCH specify the target branch
8--worktree-name NAME, --worktree-name=NAME, -w=NAME, -w NAME specify the worktree directory nameUsage examples:
1# Remove by branch name
2g-wr -t feature/old-feature
3
4# Remove by sanitized worktree directory name
5g-wr -w feature_old_featureThe command will automatically:
1g-wr - remove a git worktree for a specified branch or name
2
3g-wr [options]
4
5options:
6-h, --help show brief help
7--target-branch BRANCH, --target-branch=BRANCH, -t=BRANCH, -t BRANCH specify the target branch
8--worktree-name NAME, --worktree-name=NAME, -w=NAME, -w NAME specify the worktree directory name1# Remove by branch name
2g-wr -t feature/old-feature
3
4# Remove by sanitized worktree directory name
5g-wr -w feature_old_featureDelete a branch locally and optionally push the deletion to remote.
1g-db - delete a branch locally and optionally on remote
2
3g-db [options]
4
5options:
6-h, --help show brief help
7--target-branch BRANCH, --target-branch=BRANCH, -t=BRANCH, -t BRANCH specify the branch to deleteUsage examples:
1# Delete branch (prompts for remote deletion)
2g-db -t feature/completedThe command will automatically:
1g-db - delete a branch locally and optionally on remote
2
3g-db [options]
4
5options:
6-h, --help show brief help
7--target-branch BRANCH, --target-branch=BRANCH, -t=BRANCH, -t BRANCH specify the branch to delete1# Delete branch (prompts for remote deletion)
2g-db -t feature/completedDiscard the last commit with optional force mode.
1g-dlc - discard the last commit
2
3g-dlc [options]
4
5options:
6-h, --help show brief help
7-f, --force force discard without checking uncommitted changesUsage examples:
1# Discard last commit (soft reset)
2g-dlc
3
4# Force discard (hard reset)
5g-dlc --forceWarning: Using --force performs a hard reset, permanently discarding all uncommitted changes in your working directory. This action cannot be undone.
The command will automatically:
--force is used)--force flag1g-dlc - discard the last commit
2
3g-dlc [options]
4
5options:
6-h, --help show brief help
7-f, --force force discard without checking uncommitted changes1# Discard last commit (soft reset)
2g-dlc
3
4# Force discard (hard reset)
5g-dlc --forceClear your working directory by stashing all changes with a timestamped message.
1g-rmf - clear your working directory by stashing changes
2
3g-rmf [options]
4
5options:
6-h, --help show brief help
7--message MESSAGE, --message=MESSAGE, -m=MESSAGE, -m MESSAGE specify custom message for stashUsage examples:
1# Stash with auto-generated message
2g-rmf
3
4# Stash with custom message
5g-rmf -m "WIP: refactoring"The command will automatically:
1g-rmf - clear your working directory by stashing changes
2
3g-rmf [options]
4
5options:
6-h, --help show brief help
7--message MESSAGE, --message=MESSAGE, -m=MESSAGE, -m MESSAGE specify custom message for stash1# Stash with auto-generated message
2g-rmf
3
4# Stash with custom message
5g-rmf -m "WIP: refactoring"Reset your working directory hard to the latest remote branch, stashing changes beforehand.
1g-rto - reset to remote branch
2
3g-rto [options]
4
5options:
6-h, --help show brief helpUsage examples:
1# Reset current branch to remote
2g-rtoThe command will automatically:
1g-rto - reset to remote branch
2
3g-rto [options]
4
5options:
6-h, --help show brief help1# Reset current branch to remote
2g-rtoDisplay the current git branch name.
1g-cb - show current branch name
2
3g-cb [options]
4
5options:
6-h, --help show brief helpUsage examples:
1# Show current branch (copies to clipboard)
2g-cbThe command will automatically:
1g-cb - show current branch name
2
3g-cb [options]
4
5options:
6-h, --help show brief help1# Show current branch (copies to clipboard)
2g-cbShow the output of git status.
1g-s - show git status
2
3g-s [options]
4
5options:
6-h, --help show brief helpUsage examples:
1# Show git status
2g-sThe command will automatically:
1g-s - show git status
2
3g-s [options]
4
5options:
6-h, --help show brief help1# Show git status
2g-sCompare and show differences between two branches.
1g-diff - compare changes between two git branches
2
3g-diff [options]
4
5options:
6-h, --help show brief help
7--target-branch BRANCH, --target-branch=BRANCH, -t=BRANCH, -t BRANCH specify the target branch
8--source-branch BRANCH, --source-branch=BRANCH, -s=BRANCH, -s BRANCH specify the source branch (defaults to current branch)
9-f, --full show full diff and copy to clipboard
10--files-only show only file names (no stats, no clipboard)Usage examples:
# Compare current branch with target (shows stats, copies stats to clipboard)
g-diff -t main
# Compare two branches
g-diff -s feature/a -t feature/b
# Show only file names (no stats, no clipboard)
g-diff -t main --files-only
# Full diff (copies formatted diff to clipboard)
g-diff -t main --fullThe command will automatically:
Default mode (no flags):
Example clipboard content:
src/components/Button.tsx | 23 ++++++---------
src/utils/helper.ts | 4 ++--
src/pages/index.tsx | 15 +++++++++++
3 files changed, 28 insertions(+), 13 deletions(-)With --files-only:
Example output:
1src/components/Button.tsx
2src/utils/helper.ts
3src/pages/index.tsxWith --full:
Example clipboard content:
file: src/components/Button.tsx
stats: +15 -8
changes:
@@ -10,7 +10,9 @@ export function Button() {
- const handleClick = () => {
- console.log('clicked');
- };
+ const handleClick = useCallback(() => {
+ console.log('Button clicked');
+ onAction();
+ }, [onAction]);
file: src/utils/helper.ts
stats: +3 -1
changes:
@@ -5,7 +5,9 @@ export function formatDate() {
- return new Date().toISOString();
+ return new Date().toLocaleString('en-US', {
+ dateStyle: 'medium'
+ });1g-diff - compare changes between two git branches
2
3g-diff [options]
4
5options:
6-h, --help show brief help
7--target-branch BRANCH, --target-branch=BRANCH, -t=BRANCH, -t BRANCH specify the target branch
8--source-branch BRANCH, --source-branch=BRANCH, -s=BRANCH, -s BRANCH specify the source branch (defaults to current branch)
9-f, --full show full diff and copy to clipboard
10--files-only show only file names (no stats, no clipboard)1# Compare current branch with target (shows stats, copies stats to clipboard)
2g-diff -t main
3
4# Compare two branches
5g-diff -s feature/a -t feature/b
6
7# Show only file names (no stats, no clipboard)
8g-diff -t main --files-only
9
10# Full diff (copies formatted diff to clipboard)
11g-diff -t main --full1src/components/Button.tsx | 23 ++++++---------
2src/utils/helper.ts | 4 ++--
3src/pages/index.tsx | 15 +++++++++++
43 files changed, 28 insertions(+), 13 deletions(-)1src/components/Button.tsx
2src/utils/helper.ts
3src/pages/index.tsx1file: src/components/Button.tsx
2stats: +15 -8
3changes:
4
5 @@ -10,7 +10,9 @@ export function Button() {
6 - const handleClick = () => {
7 - console.log('clicked');
8 - };
9 + const handleClick = useCallback(() => {
10 + console.log('Button clicked');
11 + onAction();
12 + }, [onAction]);
13
14file: src/utils/helper.ts
15stats: +3 -1
16changes:
17
18 @@ -5,7 +5,9 @@ export function formatDate() {
19 - return new Date().toISOString();
20 + return new Date().toLocaleString('en-US', {
21 + dateStyle: 'medium'
22 + });1your-repo/
2├── main/ # Default branch (main/master)
3└── worktrees/ # Feature branch worktrees
4 ├── feature_1/
5 ├── feature_2/
6 └── bugfix_abc/1# Compare current branch with target (shows stats, copies stats to clipboard)
2g-diff -t main
3
4# Compare two branches
5g-diff -s feature/a -t feature/b
6
7# Show only file names (no stats, no clipboard)
8g-diff -t main --files-only
9
10# Full diff (copies formatted diff to clipboard)
11g-diff -t main --full1src/components/Button.tsx | 23 ++++++---------
2src/utils/helper.ts | 4 ++--
3src/pages/index.tsx | 15 +++++++++++
43 files changed, 28 insertions(+), 13 deletions(-)1file: src/components/Button.tsx
2stats: +15 -8
3changes:
4
5 @@ -10,7 +10,9 @@ export function Button() {
6 - const handleClick = () => {
7 - console.log('clicked');
8 - };
9 + const handleClick = useCallback(() => {
10 + console.log('Button clicked');
11 + onAction();
12 + }, [onAction]);
13
14file: src/utils/helper.ts
15stats: +3 -1
16changes:
17
18 @@ -5,7 +5,9 @@ export function formatDate() {
19 - return new Date().toISOString();
20 + return new Date().toLocaleString('en-US', {
21 + dateStyle: 'medium'
22 + });Checkout to a branch, with optional stash.
1g-co - attempt to checkout to branch
2
3g-co [options]
4
5options:
6-h, --help show brief help
7--target-branch BRANCH, --target-branch=BRANCH, -t=BRANCH, -t BRANCH specify the target branch
8--stash-changes stash changes before proceedingUsage examples:
1# Checkout to a branch
2g-co -t feature/xyz
3
4# With stash
5g-co -t main --stash-changesThe command will automatically:
--stash-changes flag is provided1g-co - attempt to checkout to branch
2
3g-co [options]
4
5options:
6-h, --help show brief help
7--target-branch BRANCH, --target-branch=BRANCH, -t=BRANCH, -t BRANCH specify the target branch
8--stash-changes stash changes before proceeding1# Checkout to a branch
2g-co -t feature/xyz
3
4# With stash
5g-co -t main --stash-changesPull changes from a remote branch.
1g-pull - pull changes from remote branch
2
3g-pull [options]
4
5options:
6-h, --help show brief help
7--target-branch BRANCH, --target-branch=BRANCH, -t=BRANCH, -t BRANCH specify the target branch
8--stash-changes stash changes before proceeding
9-f, --fetch fetch changes before pullingUsage examples:
1# Pull current branch
2g-pull
3
4# Pull specific branch with fetch
5g-pull -t develop -fThe command will automatically:
-f/--fetch flag is provided1g-pull - pull changes from remote branch
2
3g-pull [options]
4
5options:
6-h, --help show brief help
7--target-branch BRANCH, --target-branch=BRANCH, -t=BRANCH, -t BRANCH specify the target branch
8--stash-changes stash changes before proceeding
9-f, --fetch fetch changes before pulling1# Pull current branch
2g-pull
3
4# Pull specific branch with fetch
5g-pull -t develop -fPush changes to a remote branch, optionally with force.
1g-push - push changes to remote branch
2
3g-push [options]
4
5options:
6-h, --help show brief help
7--target-branch BRANCH, --target-branch=BRANCH, -t=BRANCH, -t BRANCH specify the target branch
8--stash-changes stash changes before proceeding
9--force force push changes to the target branchUsage examples:
1# Push current branch
2g-push
3
4# Force push
5g-push --forceWarning: Using --force will overwrite remote history. This can cause data loss for collaborators who have already pulled the branch. Only use force push when you're certain it's safe.
The command will automatically:
--force flag is provided (use with caution)1g-push - push changes to remote branch
2
3g-push [options]
4
5options:
6-h, --help show brief help
7--target-branch BRANCH, --target-branch=BRANCH, -t=BRANCH, -t BRANCH specify the target branch
8--stash-changes stash changes before proceeding
9--force force push changes to the target branch1# Push current branch
2g-push
3
4# Force push
5g-push --forceCreate a new git worktree with intelligent repository restructuring. On first use, automatically reorganizes your repository to support multiple worktrees. New branches are created from your current branch, preserving your branch context.
1g-wa - create git worktree for branch
2
3g-wa [options]
4
5options:
6-h, --help show brief help
7--target-branch BRANCH, --target-branch=BRANCH, -t=BRANCH, -t BRANCH specify the target branch
8--stash-changes stash changes before proceedingUsage examples:
1# Create worktree for branch (creates ../worktrees/feature_new_feature)
2# If you're on develop, the new branch will be cut from develop
3g-wa -t feature/new-feature
4
5# With stash (creates ../worktrees/develop)
6g-wa -t develop --stash-changesRepository Restructuring: On first use, g-wa will automatically reorganize your repository:
main/ subdirectoryworktrees/ directory for feature branchesFinal structure:
your-repo/
├── main/ # Default branch (main/master)
└── worktrees/ # Feature branch worktrees
├── feature_1/
├── feature_2/
└── bugfix_abc/The command will automatically:
main/ subdirectoryworktrees/ directory structure_)/Users/you/projects/your-repo/worktrees/feature_name)feature/this-is-a-very-long-branch-name → feature_this_is_a_very_long_br..)--stash-changes flagBranch Context: When creating a new branch, it will be cut from your current branch. For example, if you're on develop and run g-wa -t feature/new, the new branch will be created from develop, not from main. This ensures your new branch inherits the correct context.
1g-wa - create git worktree for branch
2
3g-wa [options]
4
5options:
6-h, --help show brief help
7--target-branch BRANCH, --target-branch=BRANCH, -t=BRANCH, -t BRANCH specify the target branch
8--stash-changes stash changes before proceeding1# Create worktree for branch (creates ../worktrees/feature_new_feature)
2# If you're on develop, the new branch will be cut from develop
3g-wa -t feature/new-feature
4
5# With stash (creates ../worktrees/develop)
6g-wa -t develop --stash-changes1your-repo/
2├── main/ # Default branch (main/master)
3└── worktrees/ # Feature branch worktrees
4 ├── feature_1/
5 ├── feature_2/
6 └── bugfix_abc/Remove a git worktree by branch name or worktree directory name.
1g-wr - remove a git worktree for a specified branch or name
2
3g-wr [options]
4
5options:
6-h, --help show brief help
7--target-branch BRANCH, --target-branch=BRANCH, -t=BRANCH, -t BRANCH specify the target branch
8--worktree-name NAME, --worktree-name=NAME, -w=NAME, -w NAME specify the worktree directory nameUsage examples:
1# Remove by branch name
2g-wr -t feature/old-feature
3
4# Remove by sanitized worktree directory name
5g-wr -w feature_old_featureThe command will automatically:
1g-wr - remove a git worktree for a specified branch or name
2
3g-wr [options]
4
5options:
6-h, --help show brief help
7--target-branch BRANCH, --target-branch=BRANCH, -t=BRANCH, -t BRANCH specify the target branch
8--worktree-name NAME, --worktree-name=NAME, -w=NAME, -w NAME specify the worktree directory name1# Remove by branch name
2g-wr -t feature/old-feature
3
4# Remove by sanitized worktree directory name
5g-wr -w feature_old_featureDelete a branch locally and optionally push the deletion to remote.
1g-db - delete a branch locally and optionally on remote
2
3g-db [options]
4
5options:
6-h, --help show brief help
7--target-branch BRANCH, --target-branch=BRANCH, -t=BRANCH, -t BRANCH specify the branch to deleteUsage examples:
1# Delete branch (prompts for remote deletion)
2g-db -t feature/completedThe command will automatically:
1g-db - delete a branch locally and optionally on remote
2
3g-db [options]
4
5options:
6-h, --help show brief help
7--target-branch BRANCH, --target-branch=BRANCH, -t=BRANCH, -t BRANCH specify the branch to delete1# Delete branch (prompts for remote deletion)
2g-db -t feature/completedDiscard the last commit with optional force mode.
1g-dlc - discard the last commit
2
3g-dlc [options]
4
5options:
6-h, --help show brief help
7-f, --force force discard without checking uncommitted changesUsage examples:
1# Discard last commit (soft reset)
2g-dlc
3
4# Force discard (hard reset)
5g-dlc --forceWarning: Using --force performs a hard reset, permanently discarding all uncommitted changes in your working directory. This action cannot be undone.
The command will automatically:
--force is used)--force flag1g-dlc - discard the last commit
2
3g-dlc [options]
4
5options:
6-h, --help show brief help
7-f, --force force discard without checking uncommitted changes1# Discard last commit (soft reset)
2g-dlc
3
4# Force discard (hard reset)
5g-dlc --forceClear your working directory by stashing all changes with a timestamped message.
1g-rmf - clear your working directory by stashing changes
2
3g-rmf [options]
4
5options:
6-h, --help show brief help
7--message MESSAGE, --message=MESSAGE, -m=MESSAGE, -m MESSAGE specify custom message for stashUsage examples:
1# Stash with auto-generated message
2g-rmf
3
4# Stash with custom message
5g-rmf -m "WIP: refactoring"The command will automatically:
1g-rmf - clear your working directory by stashing changes
2
3g-rmf [options]
4
5options:
6-h, --help show brief help
7--message MESSAGE, --message=MESSAGE, -m=MESSAGE, -m MESSAGE specify custom message for stash1# Stash with auto-generated message
2g-rmf
3
4# Stash with custom message
5g-rmf -m "WIP: refactoring"Reset your working directory hard to the latest remote branch, stashing changes beforehand.
1g-rto - reset to remote branch
2
3g-rto [options]
4
5options:
6-h, --help show brief helpUsage examples:
1# Reset current branch to remote
2g-rtoThe command will automatically:
1g-rto - reset to remote branch
2
3g-rto [options]
4
5options:
6-h, --help show brief help1# Reset current branch to remote
2g-rtoDisplay the current git branch name.
1g-cb - show current branch name
2
3g-cb [options]
4
5options:
6-h, --help show brief helpUsage examples:
1# Show current branch (copies to clipboard)
2g-cbThe command will automatically:
1g-cb - show current branch name
2
3g-cb [options]
4
5options:
6-h, --help show brief help1# Show current branch (copies to clipboard)
2g-cbShow the output of git status.
1g-s - show git status
2
3g-s [options]
4
5options:
6-h, --help show brief helpUsage examples:
1# Show git status
2g-sThe command will automatically:
1g-s - show git status
2
3g-s [options]
4
5options:
6-h, --help show brief help1# Show git status
2g-sCompare and show differences between two branches.
1g-diff - compare changes between two git branches
2
3g-diff [options]
4
5options:
6-h, --help show brief help
7--target-branch BRANCH, --target-branch=BRANCH, -t=BRANCH, -t BRANCH specify the target branch
8--source-branch BRANCH, --source-branch=BRANCH, -s=BRANCH, -s BRANCH specify the source branch (defaults to current branch)
9-f, --full show full diff and copy to clipboard
10--files-only show only file names (no stats, no clipboard)Usage examples:
# Compare current branch with target (shows stats, copies stats to clipboard)
g-diff -t main
# Compare two branches
g-diff -s feature/a -t feature/b
# Show only file names (no stats, no clipboard)
g-diff -t main --files-only
# Full diff (copies formatted diff to clipboard)
g-diff -t main --fullThe command will automatically:
Default mode (no flags):
Example clipboard content:
src/components/Button.tsx | 23 ++++++---------
src/utils/helper.ts | 4 ++--
src/pages/index.tsx | 15 +++++++++++
3 files changed, 28 insertions(+), 13 deletions(-)With --files-only:
Example output:
1src/components/Button.tsx
2src/utils/helper.ts
3src/pages/index.tsxWith --full:
Example clipboard content:
file: src/components/Button.tsx
stats: +15 -8
changes:
@@ -10,7 +10,9 @@ export function Button() {
- const handleClick = () => {
- console.log('clicked');
- };
+ const handleClick = useCallback(() => {
+ console.log('Button clicked');
+ onAction();
+ }, [onAction]);
file: src/utils/helper.ts
stats: +3 -1
changes:
@@ -5,7 +5,9 @@ export function formatDate() {
- return new Date().toISOString();
+ return new Date().toLocaleString('en-US', {
+ dateStyle: 'medium'
+ });1g-diff - compare changes between two git branches
2
3g-diff [options]
4
5options:
6-h, --help show brief help
7--target-branch BRANCH, --target-branch=BRANCH, -t=BRANCH, -t BRANCH specify the target branch
8--source-branch BRANCH, --source-branch=BRANCH, -s=BRANCH, -s BRANCH specify the source branch (defaults to current branch)
9-f, --full show full diff and copy to clipboard
10--files-only show only file names (no stats, no clipboard)1# Compare current branch with target (shows stats, copies stats to clipboard)
2g-diff -t main
3
4# Compare two branches
5g-diff -s feature/a -t feature/b
6
7# Show only file names (no stats, no clipboard)
8g-diff -t main --files-only
9
10# Full diff (copies formatted diff to clipboard)
11g-diff -t main --full1src/components/Button.tsx | 23 ++++++---------
2src/utils/helper.ts | 4 ++--
3src/pages/index.tsx | 15 +++++++++++
43 files changed, 28 insertions(+), 13 deletions(-)1src/components/Button.tsx
2src/utils/helper.ts
3src/pages/index.tsx1file: src/components/Button.tsx
2stats: +15 -8
3changes:
4
5 @@ -10,7 +10,9 @@ export function Button() {
6 - const handleClick = () => {
7 - console.log('clicked');
8 - };
9 + const handleClick = useCallback(() => {
10 + console.log('Button clicked');
11 + onAction();
12 + }, [onAction]);
13
14file: src/utils/helper.ts
15stats: +3 -1
16changes:
17
18 @@ -5,7 +5,9 @@ export function formatDate() {
19 - return new Date().toISOString();
20 + return new Date().toLocaleString('en-US', {
21 + dateStyle: 'medium'
22 + });1your-repo/
2├── main/ # Default branch (main/master)
3└── worktrees/ # Feature branch worktrees
4 ├── feature_1/
5 ├── feature_2/
6 └── bugfix_abc/1# Compare current branch with target (shows stats, copies stats to clipboard)
2g-diff -t main
3
4# Compare two branches
5g-diff -s feature/a -t feature/b
6
7# Show only file names (no stats, no clipboard)
8g-diff -t main --files-only
9
10# Full diff (copies formatted diff to clipboard)
11g-diff -t main --full1src/components/Button.tsx | 23 ++++++---------
2src/utils/helper.ts | 4 ++--
3src/pages/index.tsx | 15 +++++++++++
43 files changed, 28 insertions(+), 13 deletions(-)1file: src/components/Button.tsx
2stats: +15 -8
3changes:
4
5 @@ -10,7 +10,9 @@ export function Button() {
6 - const handleClick = () => {
7 - console.log('clicked');
8 - };
9 + const handleClick = useCallback(() => {
10 + console.log('Button clicked');
11 + onAction();
12 + }, [onAction]);
13
14file: src/utils/helper.ts
15stats: +3 -1
16changes:
17
18 @@ -5,7 +5,9 @@ export function formatDate() {
19 - return new Date().toISOString();
20 + return new Date().toLocaleString('en-US', {
21 + dateStyle: 'medium'
22 + });1your-repo/
2├── main/ # Default branch (main/master)
3└── worktrees/ # Feature branch worktrees
4 ├── feature_1/
5 ├── feature_2/
6 └── bugfix_abc/1# Compare current branch with target (shows stats, copies stats to clipboard)
2g-diff -t main
3
4# Compare two branches
5g-diff -s feature/a -t feature/b
6
7# Show only file names (no stats, no clipboard)
8g-diff -t main --files-only
9
10# Full diff (copies formatted diff to clipboard)
11g-diff -t main --full1src/components/Button.tsx | 23 ++++++---------
2src/utils/helper.ts | 4 ++--
3src/pages/index.tsx | 15 +++++++++++
43 files changed, 28 insertions(+), 13 deletions(-)1file: src/components/Button.tsx
2stats: +15 -8
3changes:
4
5 @@ -10,7 +10,9 @@ export function Button() {
6 - const handleClick = () => {
7 - console.log('clicked');
8 - };
9 + const handleClick = useCallback(() => {
10 + console.log('Button clicked');
11 + onAction();
12 + }, [onAction]);
13
14file: src/utils/helper.ts
15stats: +3 -1
16changes:
17
18 @@ -5,7 +5,9 @@ export function formatDate() {
19 - return new Date().toISOString();
20 + return new Date().toLocaleString('en-US', {
21 + dateStyle: 'medium'
22 + });1your-repo/
2├── main/ # Default branch (main/master)
3└── worktrees/ # Feature branch worktrees
4 ├── feature_1/
5 ├── feature_2/
6 └── bugfix_abc/1# Compare current branch with target (shows stats, copies stats to clipboard)
2g-diff -t main
3
4# Compare two branches
5g-diff -s feature/a -t feature/b
6
7# Show only file names (no stats, no clipboard)
8g-diff -t main --files-only
9
10# Full diff (copies formatted diff to clipboard)
11g-diff -t main --full1src/components/Button.tsx | 23 ++++++---------
2src/utils/helper.ts | 4 ++--
3src/pages/index.tsx | 15 +++++++++++
43 files changed, 28 insertions(+), 13 deletions(-)1file: src/components/Button.tsx
2stats: +15 -8
3changes:
4
5 @@ -10,7 +10,9 @@ export function Button() {
6 - const handleClick = () => {
7 - console.log('clicked');
8 - };
9 + const handleClick = useCallback(() => {
10 + console.log('Button clicked');
11 + onAction();
12 + }, [onAction]);
13
14file: src/utils/helper.ts
15stats: +3 -1
16changes:
17
18 @@ -5,7 +5,9 @@ export function formatDate() {
19 - return new Date().toISOString();
20 + return new Date().toLocaleString('en-US', {
21 + dateStyle: 'medium'
22 + });