DEV Community

Gaëtan Redin
Gaëtan Redin

Posted on • Originally published at Medium on

3 2

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

Heroku

This site is built on Heroku

Join the ranks of developers at Salesforce, Airbase, DEV, and more who deploy their mission critical applications on Heroku. Sign up today and launch your first app!

Get Started

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs