Friday, June 7, 2019

git alias in bash

We may create git-only aliases to do just "gs" for "git status" by adding these lines to C:\Users\<username>\.gitconfig file.
$ vi ~/.gitconfig

(In Vim editor: to edit press ‘i’; and to save, "esc" then "wq")


[user]
        email = bdjunayed@gmail.com
        name = Junayed M Ch
[alias]
        gs ='git status'
        ga ='git add .'
        gc ='git commit -m'
        gb ='git branch'
        gk ='git checkout'
        subl = '"/C/Program Files/Sublime Text 3/subl.exe"'
        pa ='php artisan'
        co ='composer dump-autoload'
[filter "lfs"]
        process = git-lfs filter-process
        required = true
        clean = git-lfs clean -- %f
        smudge = git-lfs smudge -- %f

# update file
source ~/.gitconfig


Some other useful aliases examples:
cm = commit -m
cma = commit -a -m
br = branch
ck = checkout
df = diff
ls = ls-files
sh = stash
sha = stash apply
shp = stash pop
shl = stash list
mg = merge
ph = push -u




OR inside the .bash_profile.

## Bash
(Win10, with git-bash installed)

```bash
cp .bash_profile .bash_profile.backup
vi ~/.bash_profile

# generated by Git for Windows
test -f ~/.profile && . ~/.profile
test -f ~/.bashrc && . ~/.bashrc

//Put these lines
alias gs='git status'
alias ga='git add .'
alias gc='git commit -m'
alias gb='git branch'
alias gk='git checkout'

alias subl='"/C/Program Files/Sublime Text 3/subl.exe"'
alias pa='php artisan'
alias co='composer dump-autoload'
alias phpunit=`"./vendor/bin/phpunit"`****
//exit vi (to edit press ‘i’, To save esc the :wq)
```

Reload terminal.

(How to add more to Git Bash on Windows)[https://gist.github.com/evanwill/0207876c3243bbb6863e65ec5dc3f058]
Wget, Xpdf ..



No comments:

Post a Comment