DEV Community

Gaëtan Redin
Gaëtan Redin

Posted on • Originally published at Medium on

My Favorite Git Commands

Git aliases

I centralize here all my favorite git command to easy use it and be faster.

git undo

How to undo the last commit

git config --global alias.undo 'reset --soft HEAD^'
Enter fullscreen mode Exit fullscreen mode

Usage:

git undo
Enter fullscreen mode Exit fullscreen mode

git upd

How to update from a remote branch

git config --global alias.upd '!f() { git fetch origin && git rebase origin/$1; }; f'
Enter fullscreen mode Exit fullscreen mode

usage

git upd master
git upd develop
...
Enter fullscreen mode Exit fullscreen mode

git new

How to create a new branch

git config --global alias.new "checkout -b"
Enter fullscreen mode Exit fullscreen mode

usage

git new <my_branch>
Enter fullscreen mode Exit fullscreen mode

git st

How to see the current git status

git config --global alias.st "status"
Enter fullscreen mode Exit fullscreen mode

usage

git st
Enter fullscreen mode Exit fullscreen mode

Oldest comments (0)