Terminal & CLI
Empowered terminal
Add the following aliases to your .zsrhc file, they'll prove very helpful.
alias gst="git status"
alias gcp="git checkout production"
alias gsw="git-sweep cleanup"
alias gplm="git pull origin master"
alias gpom="git push origin master"
alias gplp="git pull origin production"
alias gswp="git branch --merged master | grep -v '^[ *]*master$' | xargs git branch -d"
# PUSH current branch
gps() {
git push origin $(git branch | grep \* | cut -d ' ' -f2-)
}
# PULL current branch
gpl() {
git pull origin $(git branch | grep \* | cut -d ' ' -f2-)
}
RPS1="SHIP OR DIE"
Go back in time thanks to GIT. What if you would like to go back in time in the code and find that specific version of the code: you need to first find the corresponding commit and then checkout to that specific commit. See more doc here.
- 1.Find the commit thanks to git log
- 2.Git checkout to that specific commit
> git log --after="2018-12-12" --before="2019-01-01"
response: all the commits validating that constrain
commit d1695ea7974234477e2a4aec17a64bf69476343ncd (HEAD)
Merge: *****
Author: ******
Date: Sat Dec 29 19:17:26 2018 +0100
> git checkout 'd1695ea7974234477e2a4aec17a64bf69476343ncd'
On Macs, whenever you modify the metadata of a directory (e.g., should it be displayed as thumbnails or as a list?), a
.DS_Store
hidden file will be created. Very annoying. Use the following alias! When running this in a directory, all .DS_Store
files in the directory and subdirectories will be removed.alias unshite="find . -name '*.DS_Store' -type f -delete"

Last modified 3yr ago