Simple aliases for git.
To install:
git clone https://github.com/0xc00010ff/git-alias &&
cd git-alias &&
make install
To verify, run git aliases
a:add
Add a file to the indexamend:commit --amend
Add currently staged changes to the previous commit (or just rename the previous commit)aliases:config --get-regexp alias
List all aliasesb:branch
List current branchesball:branch --all
List all branches, including remote copiesbrnach:branch
Common typo for branchc:commit
Commit everything from the index into git historyclear:!clear && ls && git status
A clean git statusco:checkout
Point to a different branchd:diff
See the current unstaged (red) changes since last commitdrop:checkout --
Delete the unstaged (red) changesf:fetch
Only fetch the current branch from upstream (but no merge)graph:log --oneline --graph --decorate
Pretty git logslast:log HEAD~1..HEAD --oneline
Print the last commitlastdiff:diff HEAD~1 HEAD
Show the difference between the last commit and the one beforelist:log --oneline
A condensed form of the commit logmastiff:log --oneline main..HEAD
Compare commits between this branch and mainnew:checkout -b
Compare commits between this branch and mainpr: Some heady bash script... view source for details Creates a pull request off the current branch. Make sure you pushed first!pullrequest: Some heady bash script... view source for details Long form for the above.remain:! _current=$(git branch | sed -n -e "s/^\* \(.*\)/\1/p") && git checkout main && git pull && git checkout $_current && git rebase main
This one is heavy. Pop over to main, pull, pop back to the current branch and rebase main. You might want to stash first.rename:branch -m
Rename the current branchs:!clear && ls && git status
A clean git status, same as clearstage:add
Add files to the staging area (green)unamend:reset --soft HEAD@{1}
Undo the amend you just did, if you did oneuncommit:reset HEAD~1 --soft
Reset the previous commit's changes back into the staging area (green)unstage:reset
Move changes out of the stage (green) into the working area (red)