Last active
December 13, 2024 21:04
-
-
Save richy486/2279902 to your computer and use it in GitHub Desktop.
bash profile
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# BASH PROFILE!! | |
# reload without closing terminal window with $ source ~/.bash_profile | |
# Alias' | |
export LSCOLORS="ExGxBxDxCxEgEdxbxgxcxd" | |
alias ls="ls -G -a -l" | |
alias glog="git log --graph --date-order --date=relative --color=always --oneline" | |
alias gstat="git status -s" | |
alias mm?="git branch --merged master" | |
alias cdd="rm -rf ~/Library/Developer/Xcode/DerivedData" | |
alias cdp="git checkout develop; git pull;" | |
alias ulc="git reset HEAD~" | |
alias resetSpotlight="sudo mdutil -a -i off;sudo mdutil -a -i on" | |
# git config --global color.status auto | |
export PATH=~/scripts:$PATH | |
export PATH=/Library/Developer/Toolchains/swift-latest.xctoolchain/usr/bin:"${PATH}" | |
# Swift env | |
# https://github.com/kylef/swiftenv | |
export SWIFTENV_ROOT="$HOME/.swiftenv" | |
export PATH="$SWIFTENV_ROOT/bin:$PATH" | |
eval "$(swiftenv init -)" | |
# Xcode Select | |
xcselect() { | |
sudo xcode-select -s /Applications/"$1"/Contents/Developer | |
xc | |
} | |
xclist() { | |
ls -1 /Applications/ | sed 's#.*/##' | grep "Xcode" | |
} | |
xc() { | |
echo "Selected Xcode: " | |
xcode-select -p | |
echo "xc - This message" | |
echo "xclist - List Xcodes" | |
echo "xcselect [xcode from list] - List Xcodes" | |
} | |
alias swiftGitignore="curl https://raw.githubusercontent.com/github/gitignore/master/Swift.gitignore > .gitignore" | |
# Cocoapods | |
alias repod="rm -rf \"${HOME}/Library/Caches/CocoaPods\"; rm -rf \"`pwd`/Pods/\"; pod update" | |
#fastlane | |
export PATH="$HOME/.fastlane/bin:$PATH" | |
#android | |
export PATH=~/Library/Android/sdk/tools:$PATH | |
export PATH=$ANDROID_HOME/emulator:"${PATH}" | |
export ANDROID_HOME=~/Library/Android/sdk | |
# --------- Git ----------- | |
# get current branch in git repo | |
function parse_git_branch() { | |
BRANCH=`git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/'` | |
if [ ! "${BRANCH}" == "" ] | |
then | |
STAT=`parse_git_dirty` | |
echo "[${BRANCH}${STAT}]" | |
else | |
echo "" | |
fi | |
} | |
# get current status of git repo | |
function parse_git_dirty { | |
status=`git status 2>&1 | tee` | |
dirty=`echo -n "${status}" 2> /dev/null | grep "modified:" &> /dev/null; echo "$?"` | |
untracked=`echo -n "${status}" 2> /dev/null | grep "Untracked files" &> /dev/null; echo "$?"` | |
ahead=`echo -n "${status}" 2> /dev/null | grep "Your branch is ahead of" &> /dev/null; echo "$?"` | |
newfile=`echo -n "${status}" 2> /dev/null | grep "new file:" &> /dev/null; echo "$?"` | |
renamed=`echo -n "${status}" 2> /dev/null | grep "renamed:" &> /dev/null; echo "$?"` | |
deleted=`echo -n "${status}" 2> /dev/null | grep "deleted:" &> /dev/null; echo "$?"` | |
bits='' | |
if [ "${renamed}" == "0" ]; then | |
bits=">${bits}" | |
fi | |
if [ "${ahead}" == "0" ]; then | |
bits="*${bits}" | |
fi | |
if [ "${newfile}" == "0" ]; then | |
bits="+${bits}" | |
fi | |
if [ "${untracked}" == "0" ]; then | |
bits="?${bits}" | |
fi | |
if [ "${deleted}" == "0" ]; then | |
bits="x${bits}" | |
fi | |
if [ "${dirty}" == "0" ]; then | |
bits="!${bits}" | |
fi | |
if [ ! "${bits}" == "" ]; then | |
echo " ${bits}" | |
else | |
echo "" | |
fi | |
} | |
# --------- Prompt ----------- | |
export PS1="\[\e[34m\]\u\[\e[m\]:\[\e[32m\]\w\[\e[m\] \[\e[33m\]\`parse_git_branch\`\[\e[m\]$ " |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment