Created
June 28, 2023 13:04
-
-
Save Rami-Majdoub/f2672e53ea4eea82034b9de6fce618ed to your computer and use it in GitHub Desktop.
bash setup
This file contains 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
merge-dev(){ | |
current_branch="$(git branch --show-current)" | |
git checkout dev | |
git pull | |
git checkout "$current_branch" | |
git merge dev | |
} | |
gitbackup(){ | |
today=$(date +%F-%H-%M) | |
current_branch="$(git branch --show-current)" | |
new_branch="${current_branch}-${today}" | |
git checkout -b "$new_branch" | |
git add . | |
git commit -m "backup" | |
last_commit="$(git rev-parse --short HEAD)" | |
git checkout "$current_branch" | |
git cherry-pick "$last_commit" --no-commit | |
} | |
gl(){ | |
git log --decorate --oneline --max-count=5 | |
} | |
gitlastcommit(){ | |
current_branch="$(git branch --show-current)" | |
git checkout "$1" | |
last_commit="$(git rev-parse --short HEAD)" | |
git checkout "$current_branch" | |
git cherry-pick "$last_commit" --no-commit | |
git reset HEAD -- . | |
} |
This file contains 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
loadFileIfExist(){ | |
[ -f $1 ] && . $1 || true | |
} | |
loadFolderIfExist(){ | |
if [ -d $1 ] ; then | |
export PATH="$PATH:$1" | |
fi | |
} | |
loadFileIfExist ~/.bash_shortcuts |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment