git_aliases provide short-hands for git. Immensely are the functions written for saving the time of each developer. git works on any POSIX-compliant shell (sh, dash, ksh, zsh, bash), in particular on these platforms: unix, macOS, and windows WSL.
Only works with git, please be sure it should be installed on the machine.
apt install gitTo install or update, you should run the install script. To do that, you may either download and run the script manually or use the following cURL or wget command:
curl -o- https://raw.githubusercontent.com/vulrun/git-aliases/v1.3-beta/install.sh | bashwget -qO- https://raw.githubusercontent.com/vulrun/git-aliases/v1.3-beta/install.sh | bashRunning either of the above commands downloads a script and runs it. The script downloads the script to $HOME generally at ~/, and attempts to add the source lines from the snippet below to the correct profile file (~/.bash_profile, ~/.zshrc, ~/.profile, or ~/.bashrc).
-
If the environment variable
$XDG_CONFIG_HOMEis present, it will place the.git_aliasesfile there. -
You can customize the install source, directory, profile, and version using the
XYZ_SOURCE,XYZ_DIR,PROFILE, andNODE_VERSIONvariables. Eg:curl ... | NVM_DIR="path/to/git-aliases". Ensure that theNVM_DIRdoes not contain a trailing slash. -
The installer can use,
curl, orwgetto download.git_aliases, whichever is available.
To verify that git-aliases has been installed, do:
git-aliaseswhich should output aliases version, if the installation was successful. Please note that which git-aliases will not work, since all are sourced shell functions, not executable binaries.
For a fully manual install, execute the following lines to first clone repository into $HOME, and moving file out of the directory & then load it:
git clone https://github.com/webcdn/git-aliases.git "$HOME"
cd "$HOME"
mv ./git-aliases/aliases.sh ./.git_aliases
source ./.git_aliasesNow, add these lines to your ~/.bashrc, ~/.profile, or ~/.zshrc file to have it automatically sourced upon login:
(you may have to add to more than one of the above files)
[ -s "$HOME/.git_aliases" ] && source "$HOME/.git_aliases" # This loads git-aliasesTo remove aliases manually, execute the following:
rm "$HOME/.git_aliases"Edit your profile-files ~/.bashrc, ~/.profile, or ~/.zshrc (or other shell resource config) and remove the lines similar to :
[ -s "$HOME/.git_aliases" ] && source "$HOME/.git_aliases" # This loads git-aliasesArguments are written in square braces [...] are optional. [**] denotes, you can always use core options/commands from core git.
git-vergoto πgit-llgoto πgit-loggoto πgit-logsgoto πgit-it "your commit message"goto πgit-up ["your commit message" [origin [branch]]] [**]goto πgit-amend ["your commit message"]goto πgit-amend-now ["your commit message"]goto πgit-push [origin [branch]] [**]goto πgit-pushf [origin [branch]] [**]goto πgit-pull [origin [branch]] [**]goto πgit-pullf [origin [branch]]goto πgit-clean [reflogs]goto πgit-cleargoto πgit-sync [origin [branch]]goto πgit-fixitgoto πgit-fixup [origin [branch]] [**]goto πgit-rebase [**]goto πgit-merge <branch>goto πgit-merge-to <branch>goto πgit-reset [commit_hash]goto πgit-resetf [commit_hash]goto πgit-stashgoto πgit-sstashgoto πgit-nstashgoto π
Prints the current version of the git-aliases
git-ver
# v1.0-betaLong List of commit history, each in single row with proper color for better readability (latest to oldest order)
git-ll
git-log
git-logs
# <comit-id> - <origin-branch> <commit-message> (<commit-time>) [<commit-author>]add all files to staged list and commit it
git-it "your commit message"Please ensure your commit message follows the conventional commits format:
type(scope): description
- type could be one of: build, chore, ci, docs, feat, fix, perf, refactor, revert, style
- scope is optional and can be anything specifying the place of the commit change
- description is a short description of the change
These conventions make it easier for others to understand the changes, streamline the development process, and help in generating changelogs or navigating through the history of the project.
- build: changes that affect the build system or external dependencies
- chore: regular code maintenance
- ci: changes made to CI configuration files and scripts
- docs: documentation related changes
- feat: a new feature added
- fix: a bug fix
- perf: changes that improves performance
- refactor: changes that neither fixes a bug nor adds a feature
- revert: if the commit reverts a previous commit, this is used with the hash of the commit being reverted
- style: changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)
- test: changes that adds missing tests or corrects existing tests
Add all files to staged list and commit it. Finally, push up to the remote server. You may specify origin & branch at the end.
git-up "your commit message"
git-up "new featured changes" origin betaModifying your last commit. This will update uncommit changes to the last commit. If you are specifying the commit-message, then it will be updated too. Mostly used for correction purposes. In case of amendments, code must be pushed forcefully otherwise it will throw an error.
git-amend
git-amend "your commit message"Modifying your last commit. This will update commit time, author who is working at the foremost. If you are specifying the commit-message, then it will be updated too. Mostly used for correction purposes. In case of amendments, code must be pushed forcefully otherwise it will throw an error.
git-amend-now
git-amend-now "your commit message"Push all pending commits to remote cloud. If pushed with
git-pushf, commits are forced to be pushed.
git-push
# with origin
git-push new_origin
# with origin & branch
git-push new_origin slave
# you may also add core git push options at the end
git-push new_origin staging
# NOTE: git-pushf options are same as in git-pushPull all pending commits from remote cloud. This is launched with auto detection.
git-pull
# with origin
git-pull new_origin
# with origin & branch
git-pull new_origin slave
# you may also add core git pull options at the end
git-pull new_origin staging
Pull changes from remote cloud, and forcefully reset with your current branch.
git-pullf
# with origin
git-pullf new_origin
# with origin & branch
git-pullf new_origin staging
Clean garbage or unnecessary reflog objects from the
.gitdirectory. It works locally.
git-cleanClear your working space. This will remove all staged & unstaged files.
git-clearSync from remote. This additionally clear all the staged files & then pull the code forcefully
git-sync
# with origin
git-sync new_origin
# with origin & branch
git-sync new_origin stagingFixing previous commit. This will add a new commit with fixup tag as prefix to previous commit message.
# same purpose as git-amend but here this will create a new commit
git-fixitFixing previous commit & push it. This will add a fixup commit & push on remote origin.
# same purpose as git-amend but here this will create a new commit
git-fixup
# with origin
git-fixup origin
# with origin & branch
git-fixup new_origin stagingAutomatically Rebase Commits. This will rebase you commits based on the prefix keywords added till the provided
HEAD/HASH.
# rebasing till hash
git-rebase 84c63b39
git-rebase 84c63b3910bb28b5f0549e235ac0f4f3a3c71a1b
# rebasing last 5 commits
git-rebase HEAD~5
# rebasing from root
git-rebase --rootAutomatically Merge Branch. This ensures that the merge is always done with a separate merge commit.
# merging new branches
git-merge feature-branch
git-merge another-feature-branchAutomatically Merge Branch. This helps to merge the feature branch to main branch without changing the branch, you can continue working in the same feature branch.
# merging feature branch to
git-merge-to main-branch
git-merge-to another-main-branchRemove Commit. If reset with
git-resetf, codes are forced to be updated.
# removes last commit from history only
git-reset
# removes commit upto this hash,
# but the code remains unchanged
git-reset 84c63b39
git-reset 84c63b3910bb28b5f0549e235ac0f4f3a3c71a1b
# removes last commit & codes
git-resetf
# removes upto commit hash & codes
git-resetf 84c63b39
git-resetf 84c63b3910bb28b5f0549e235ac0f4f3a3c71a1bStash all changes, including untracked files.
This function stashes all your local changes (both staged and unstaged), including untracked files, safely.
git-stashStash only staged files, keeping unstaged changes left in the working directory.
Use this when you want to stash just the staged changes while leaving your unstaged changes untouched in the working directory.
git-sstashStash only unstaged files, keeping staged changes left in the working directory.
Use this when you want to stash just your unstaged changes, while keeping staged changes intact in your working directory.
git-nstash$ git-it
# c1b8fd544 - oauth added (1 minutes ago) [webcdn]
$ git-fixit
# 7056e6ef2 - fixup! oauth added (1 minutes ago) [webcdn]
# c1b8fd544 - oauth added (2 minutes ago) [webcdn]
$ git-fixit
# d4bc5b9fa - fixup! fixup! oauth added (1 minutes ago) [webcdn]
# 7056e6ef2 - fixup! oauth added (2 minutes ago) [webcdn]
# c1b8fd544 - oauth added (2 minutes ago) [webcdn]
$ git-rebase HEAD~3
# e33621e8e - oauth added (a few seconds ago) [webcdn]Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Please make sure to update tests as appropriate.