I'm using iTerm
and Github Desktop
to use Git and Github since sometimes don't want to type any commands to work with Github.
However, sometimes prefer typing commands instead of clicks lol.
For example,
When I want to rename a branch, I need to click branch
> rename
and rename the branch then click Rename
. On the other hand, with iTerm
I just need to type the following. Actually, there is the shortcut for rename, but I don't remember that 😝
$ git branch -m <new_name>
The command isn't long, but people who are a software engineer, developer web engineer, web developer are basically lazy. (My first CTO told me that engineers/developers should be lazy
)
So what we need to do is to shorten commands as much as possible 😂
In terms of git commands what we can do is the followings.
-
git
-->g
- add aliases to
.gitconfig
forbranch
-->b
Actually, you can add gb
as git branch
, but I feel using .gitconfig could be better
Step 1
Add the following to your .zshrc, .bashrc etc.
alias g='git
Step 2
Add the followings to .gitconfig
The file is in your home folder
[alias]
# basic commands
b = branch
p = push
c = commit
cm = commit -m
f = fetch
s = status
st = stash
rh = reset --hard
# update
m = merge
l = log
last = log -3 HEAD --decorate
The last one is from @vlasales, thank you for your comment!
Now we can type the following
$ g b -m <new_name>
@rmnvsl thank you for your suggestion!
Latest comments (3)
nice!
I should add log
GitHub aliases are really helpful, especially when you want to dig deeper with
git log
.Your GIF is huge (6.5MB), try to resize it or capture smaller part of the screen ;)