Search
 
SCRIPT & CODE EXAMPLE
 

SHELL

git shothand commands

# ----------------------
# Git Aliases
# ----------------------
alias ga='git add'
alias gaa='git add .'
alias gaaa='git add --all'
alias gau='git add --update'
alias gb='git branch'
alias gbd='git branch --delete '
alias gc='git commit'
alias gcm='git commit --message'
alias gcf='git commit --fixup'
alias gco='git checkout'
alias gcob='git checkout -b'
alias gcom='git checkout master'
alias gcos='git checkout staging'
alias gcod='git checkout develop'
alias gd='git diff'
alias gda='git diff HEAD'
alias gi='git init'
alias glg='git log --graph --oneline --decorate --all'
alias gld='git log --pretty=format:"%h %ad %s" --date=short --all'
alias gm='git merge --no-ff'
alias gma='git merge --abort'
alias gmc='git merge --continue'
alias gp='git pull'
alias gpr='git pull --rebase'
alias gr='git rebase'
alias gs='git status'
alias gss='git status --short'
alias gst='git stash'
alias gsta='git stash apply'
alias gstd='git stash drop'
alias gstl='git stash list'
alias gstp='git stash pop'
alias gsts='git stash save'

# ----------------------
# Git Functions
# ----------------------
# Git log find by commit message
function glf() { git log --all --grep="$1"; }


#USAGE

for example, instead of git add assets/css/screen.css, you can run:

ga assets/css/screen.css
or instead of git checkout -b <branch-name>:

gcob <branch-name>


gld is a detailed, one-line view of git log:

$ gld
dba068d 2015-02-11 Remove stop propagation.
37372ec 2015-02-11 Remove third-party Twitter widget.js completely and replace with intent link.
7d1a5d2 2015-02-11 Uglify critical in production task.


By default gm, the alias for git merge, defaults to --no-ff (no fast-forward)—many times I have more than 1 feature branch in development, each of those branches has more than 1 commit, and I feel that the history of the merges are important.

Occasionally I want to search for a commit by the commit message. Using glf:

glf "commit message"
You should get an output like follows:

$ glf "logic"
commit 95ed7d5b6f6d168047fd8ddc86579ce09ca39394
Author: Jonathan Suh <hello@jonsuh.com>
Comment

PREVIOUS NEXT
Code Example
Shell :: how to turn on wireguard 
Shell :: turn off wiregurad 
Shell :: windows execute file command 
Shell :: step3 pgadmin ubuntu 20.04 
Shell :: linux create file without content 
Shell :: bash check in gem is installed 
Shell :: git remove all changes 
Shell :: bash script wget 
Shell :: openvpn client docker 
Shell :: install document viewer ubuntu 
Shell :: how to get the vimrc path 
Shell :: what terminal command screen record on mac 
Shell :: Check Firewall setup 
Shell :: some github markup badges 
Shell :: terminal mkv to mp4 
Shell :: tar: Cowardly refusing to create an empty archive 
Shell :: powershell get disk space remote computer 
Shell :: command can be used to find files or folders matching a particular search pattern in linux 
Shell :: powershell command shutdown computer 
Shell :: git sync branch from master 
Shell :: linux os update 
Shell :: linux command find executable 
Shell :: linux command to show memory hardware 
Shell :: xargs curl url 
Shell :: git reset uncommitted changes 
Shell :: open folder in terminal mac 
Shell :: bash array 
Shell :: flutter sdk download 
Shell :: add ufw rule from 
Shell :: how to use usb 3 with virtualbox 
ADD CONTENT
Topic
Content
Source link
Name
7+4 =