How to define Git commands Aliases

Method 1:

$ git config --global alias.co checkout
$ git config --global alias.br branch
$ git config --global alias.ci commit
$ git config --global alias.st status
$ git config --global alias.ci 'commit -v'
c:\dev> git config --global alias.ci "commit -v"

Method 2:

[alias]
st = status
ci = commit -v
[alias]
st = status
ci = commit
co = checkout
br = branch
unstage = reset HEAD --
last = log -1 HEAD
$ git config --global alias.unstage 'reset HEAD --'
$ git unstage fileA
$ git reset HEAD -- fileA
$ git config --global alias.last 'log -1 HEAD'
$ git last
commit 66938dae3329c7aebe598c2246a8e6af90d04646
Author:
Date: Tue Aug 26 19:48:51 2008 +0800
$ git config --global alias.visual '!gitk'

--

--

--

Posting about Python and Laravel

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Making mistakes with GraphQL

I Thought I Wasn’t the “Programmer Type”

Service Mesh — Istio

From Solo to Pair programming

Meddle into Mettle Web Components

Prison Cells After N Days

Overcoming Mobile Development Challenges for Consumer Apps

My Experience at Devcreer x Progate

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Panjeh

Panjeh

Posting about Python and Laravel

More from Medium

ngrok — Make full use of free tier version to expose your localhost to the internet

Docker Ep 16: Named Volumes

Git Undo Scenarios

How to Reset a Root Password in CentOS-based Linux Systems