Quais alias vocês usam? #373
Replies: 10 comments
-
git
|
Beta Was this translation helpful? Give feedback.
-
@brunoqueiros Bem interessante o alias do log.. Permita-me, vou adicionar aqui no meu workflow.. Obrigado..
Alguns dos aliases que uso no meu ambiente.. |
Beta Was this translation helpful? Give feedback.
-
Eu roubei Os que eu acho que mais uso são: functions function mkd() {
mkdir -p "$@" && cd "$@";
}
# `s` with no arguments opens the current directory in Sublime Text, otherwise
# opens the given location
function s() {
if [ $# -eq 0 ]; then
subl .;
else
subl "$@";
fi;
}
alias # Easier navigation: .., ..., ~ and -
alias ..="cd .."
alias cd..="cd .."
alias ...="cd ../.."
alias ....="cd ../../.."
alias .....="cd ../../../.."
alias -- -="cd -"
# Shortcuts
alias dl="cd ~/Downloads"
alias dev="cd ~/Development"
alias g="git"
# Show/hide hidden files in Finder
alias show="defaults write com.apple.finder AppleShowAllFiles -bool true && killall Finder"
alias hide="defaults write com.apple.finder AppleShowAllFiles -bool false && killall Finder"
# Hide/show all desktop icons (useful when presenting)
alias hidedesktop="defaults write com.apple.finder CreateDesktop -bool false && killall Finder"
alias showdesktop="defaults write com.apple.finder CreateDesktop -bool true && killall Finder"
# Kill all the tabs in Chrome to free up memory
# [C] explained: http://www.commandlinefu.com/commands/view/402/exclude-grep-from-your-grepped-output-of-ps-alias-included-in-description
alias chromekill="ps ux | grep '[C]hrome Helper --type=renderer' | grep -v extension-process | tr -s ' ' | cut -d ' ' -f2 | xargs kill"
git [alias]
lg1 = log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(dim white)- %an%C(reset)%C(bold yellow)%d%C(reset)' --all
lg2 = log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold cyan)%aD%C(reset) %C(bold green)(%ar)%C(reset)%C(bold yellow)%d%C(reset)%n'' %C(white)%s%C(reset) %C(dim white)- %an%C(reset)' --all
lg = !"git lg1"
# View abbreviated SHA, description, and history graph of the latest 20 commits
l = log --pretty=oneline -n 20 --graph --abbrev-commit
# View the current working tree status using the short format
s = status
# Show the diff between the latest commit and the current state
d = !"git diff-index --quiet HEAD -- || clear; git --no-pager diff --patch-with-stat"
# `git di $number` shows the diff between the state `$number` revisions ago and the current state
di = !"d() { git diff --patch-with-stat HEAD~$1; }; git diff-index --quiet HEAD -- || clear; d"
# Push in remote changes
ps = push origin master
# Pull from remote with rebase
pr = pull --rebase
# Clone a repository including all submodules
c = clone --recursive
# Go to Master and update
update-master = !git checkout master && git pull origin master
# Commit all changes
ca = !git add -A && git commit -av
# Switch to a branch, creating it if necessary
go = "!f() { git checkout -b \"$1\" 2> /dev/null || git checkout \"$1\"; }; f"
# Show verbose output about tags, branches or remotes
tags = tag -l
branches = branch -a
remotes = remote -v
# Amend the currently staged files to the latest commit
amend = commit --amend --reuse-message=HEAD
# Credit an author on the latest commit
credit = "!f() { git commit --amend --author \"$1 <$2>\" -C HEAD; }; f"
mm = merge master
# Remove branches that have already been merged with master
# a.k.a. ‘delete merged’
dm = "!git branch --merged | grep -v '\\*' | xargs -n 1 git branch -d"
# List contributors with number of commits
contributors = shortlog --summary --numbered
|
Beta Was this translation helpful? Give feedback.
-
Os meus antes de eu roubar vários desta thread 😄 #git
alias gs='git status'
alias gl='git pull'
alias gp='git push'
alias gd='git diff'
alias ga='git add'
alias gr='git rm'
alias gc='git commit -m'
alias gca='git commit --amend'
alias gck='git checkout'
alias glog='git log'
alias gsta='git stash'
alias gstaa='git stash apply'
#jekyll
alias js='bundle exec jekyll serve'
alias jb='bundle exec jekyll build' |
Beta Was this translation helpful? Give feedback.
-
Life helper
mas instalem o thefuck: aí configurem ele assim: eval "$(thefuck --alias)"
eval "$(thefuck --alias FUCK)" https://github.com/nvbn/thefuck GITPra git o melhor alias (que é um git alias) que eu tenho e parecido com os acima é o git config --global alias.lg "log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative" Esse cara salva minha vida com visualização de logs. De resto, não uso mais nenhum alias. .-. E meio bagunçado ainda por falta de vergonha na cara, aqui tem umas coisas legais que uso: https://github.com/matmarsiglio/dotfiles |
Beta Was this translation helpful? Give feedback.
-
Eu costumo usar os do Pessoais, eu tenho alguns: Pra usar sudo com o alias sudo='sudo env PATH=$PATH:$NVM_BIN' Ae tem uns mais básicos: # Subir servidor estático com Python
function pyserver () {
python -m SimpleHTTPServer 9001
}
# Dar push na branch atual
function push () {
git push origin $(git branch | grep \* | sed 's/\*\s//')
}
# Habilitar / desabilitar microfone no headphone, pra ver se o volume está ok
function mic () {
case "$1" in
"on")
pactl load-module module-loopback latency_msec=1 ;;
"off")
pactl unload-module module-loopback ;;
esac
} Só esses xD |
Beta Was this translation helpful? Give feedback.
-
Maneiro ver que tu usa umas coisas minhas @herberthenrique xD Pior que preciso dar uma atualizada, criei várias novas mágicas HAHAUHAUHAU |
Beta Was this translation helpful? Give feedback.
-
Atualmente utilizo a estrutura da seguinte maneira: https://github.com/amplaeducacao/devfiles (essa versão está um pouco desatualizada) Os alias estão no arquivo .bashrc |
Beta Was this translation helpful? Give feedback.
-
Ultimamente tenho tentado aprender mais unix então removi a maioria dos meus alias e acabo usando os comandos inteiros e aprendendo mais sobre a interface deles. Uso alias somente para git que são esses comuns que todo mundo usa por exemplo: #.gitconfig file
[alias]
st = status
co = checkout
br = branch
ci = commit
l = log --oneline
t = tag
lg = log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit
cleanup = "!git fetch --all --prune; git branch --merged origin/master | grep -v \"\\*\" | grep -v \"\\ master\" | xargs -n 1 git branch -d"``` |
Beta Was this translation helpful? Give feedback.
-
Alguns dos que utilizo aqui: Git
OSx
|
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Fala pessoal, beleza?
Estava falando com o @felquis no Twitter, e chegamos em um assunto interessante.
Quais alias (git, bash...), vocês costumam usar no projeto de vocês?
Beta Was this translation helpful? Give feedback.
All reactions