A collection of shell commands to streamline your Git workflow and maintain a clean, understandable Git history.
Install with curl
sh -c "$(curl -fsSL "https://raw.githubusercontent.com/krystalcampioni/git-glider/main/install.sh?$(date +%s)")"
or
bash <(curl -fsSL https://raw.githubusercontent.com/krystalcampioni/git-glider/main/install.sh)
run gitGlider --help
for a full list of commands and aliases
git commit -m --no-verify
runs git commit skipping pre-commit checks
gcmsgn "Your commit message"
Pushes the current branch to the origin with --force-with-lease
pushs
Starts an interactive rebase of the last num_commits
commits.
rebaseLast 4
Undoes the last num_commits
commits and leaves the changes in the staging area.
undoLast 3
Opens the browser to compare the current branch to the main branch on Github
openpr
Squashes a range of commits between hashA
and hashB
into a single commit with a new commit message.
⚠️ hashA has to be older than hashB
squashRange <hashA> <hashB> "optional new commit message"
Squashes the last num_commits
into a single commit with a new commit message.
squashLast 2 "optional new commit message"
git pull --rebase
fetches the updates from the remote repository and applies your local changes on top of those updates.
git commit -m
allows you to commit changes with a message.
git add
stages changes for the next commit.
git status
shows the status of changes as untracked, modified, or staged.
git pull origin main --rebase
fetches updates from the main branch of the origin remote and applies your local changes on top.
git log -p
which shows commit logs and diff about what was modified.
git log --oneline --decorate --graph
shows a decorated, one-line commit history with a graph illustrating branch merges.
git clean -f -d
removes untracked files and directories.
git commit --amend --message
allows you to change the message of the most recent commit.
git reset HEAD~
Undoes the last commit and leaves the changes in the working area.
Performs a git add . && git commit --amend --no-edit
Stages all changes and ads them to the most recent commit without changing the commit message.
Performs the equivalent of git checkout -b <current-branch-name>_backup && git checkout -
Creates a backup of your current branch without leaving your current branch
Saves changes to the stash with a name. Includes untracked by default.
stashByName <stash_name> <optional --no-untracked>
Applied the stash by its saved name.
applyStash <stash_name>
Pops the stash by its saved name.
popStash <stash_name>
alias: ffs
Finds the path to the file name provided and applies the changes to the working area. If no stash index is provided it will default to the last stash
fileFromStash <filename> <optional-stash-id>
Contributions are welcome! 💪 If you have a command or alias that has improved your Git workflow, please consider sharing it with the community.
This project loves Oh My Zsh, a delightful community-driven framework for managing your Zsh configuration. Some of the aliases used in this project are defined in Oh My Zsh. If you haven't installed it yet, we highly recommend checking it out to enhance your terminal experience. Visit https://ohmyz.sh to learn more. ❤️