Skip to content

Instantly share code, notes, and snippets.

@saish98
Last active April 12, 2023 11:15
Show Gist options
  • Save saish98/df96b28d98508e2677b8416261f4b270 to your computer and use it in GitHub Desktop.
Save saish98/df96b28d98508e2677b8416261f4b270 to your computer and use it in GitHub Desktop.
Setup New Macbook Pro
# Path to your oh-my-zsh installation.
export ZSH="$HOME/.oh-my-zsh"
# Set name of the theme to load --- if set to "random", it will
# load a random theme each time oh-my-zsh is loaded, in which case,
# to know which specific one was loaded, run: echo $RANDOM_THEME
# See https://github.com/ohmyzsh/ohmyzsh/wiki/Themes
ZSH_THEME="robbyrussell"
# Uncomment one of the following lines to change the auto-update behavior
# zstyle ':omz:update' mode disabled # disable automatic updates
zstyle ':omz:update' mode auto # update automatically without asking
# zstyle ':omz:update' mode reminder # just remind me to update when it's time
# Uncomment the following line to change how often to auto-update (in days).
zstyle ':omz:update' frequency 30
#history | grep -i
plugins=(
history
git
macos
zsh-autosuggestions
last-working-dir
xcode
)
source $ZSH/oh-my-zsh.sh
## git aliases
alias gci="git commit --allow-empty -m 'Trigger CI'";
alias gcd="git checkout develop";
alias gc="git checkout";
alias grb="git rebase";
alias grbd="git pull --rebase origin develop";
alias gs="git status";
alias gpull="git pull origin";
alias gfa="git fetch --all";
alias gf="git fetch origin";
alias gpushf = "git push origin --force-with-lease"
alias gpush="git push -u origin";
alias gd="git diff";
alias gb="git branch";
alias gbr="git branch remote"
alias gfr="git remote update"
alias gcb="git checkout -B "
alias grh="git reset HEAD~" # last commit
alias gac="git add . && git commit -m"
alias gsu="git push --set-upstream origin"
alias ga="git add --all"
alias gremoveLocal="git config fetch.prune true"
alias grmlocal="git branch | grep -v develop | xargs git branch -D"
if which rbenv > /dev/null; then eval "$(rbenv init -)"; fi
# Change color of auto suggestions to something that can be visible, Since the default is not!
ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE='fg=10'
1. Install Homebrew
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
2. Install zsh
sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
3. Download links
- VS Code: https://code.visualstudio.com/download
- Xcode: https://developer.apple.com/xcode/
- iterm: https://iterm2.com/downloads.html
- Sublime: https://www.sublimetext.com
- https://www.sourcetreeapp.com
- https://www.postman.com/downloads/
4. Install Ruby
https://github.com/wadhwakamal/Rbenv-Cocoapods-Install-Guide
5. Handle multiple git account
https://medium.com/make-it-heady/how-to-manage-multiple-github-account-d67dc1aef705
1. Git push force with lease
git push --force-with-lease
2. Git push with upstream
git push -u origin the-feature-branch
3. Follow the naming convention for branch
eg. feature/saish/BB-390-login
4. Clean up local branches (Here develop is default branch)
git branch | grep -v develop | xargs git branch -D
or
Automatically removes on fetch
git config fetch.prune true
5. Clean up locally store remote branch
git branch -r
git remote prune origin --dry-run
git remote purn origin
6. Rebase instead of merge
git pull --rebase origin develop
7. Auto stash on Pull
git config rebase.autoStash true
8. Squash before merge
9. Amend
git commit --amend
10. Links
https://itnext.io/git-force-vs-force-with-lease-9d0e753e8c41
https://itnext.io/16-git-tips-and-tricks-bf08d0602d3b
https://www.conventionalcommits.org/en/v1.0.0/
https://udacity.github.io/git-styleguide/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment