Skip to content

Instantly share code, notes, and snippets.

@iletai
Last active March 18, 2024 09:26
Show Gist options
  • Save iletai/dd8ec855d5d8de81174231502df6e274 to your computer and use it in GitHub Desktop.
Save iletai/dd8ec855d5d8de81174231502df6e274 to your computer and use it in GitHub Desktop.
#!/bin/bash
current_branch=$(git branch --show-current)
stash_name="$(date +%Y-%b-%d/%H-%M-%S)/$current_branch_name"
git fetch origin $current_branch
cd "$1"
if [ -f "Podfile.lock" ]; then
echo ""
echo -e "=> Podfile.lock exists! Reset Lock File\n"
git checkout HEAD -- Podfile.lock
else
echo -e "=> Podfile.lock does not exist\n"
fi
git stash --include-untracked -m "$stash_name"
echo -e "=> START PULL BRANCH: $current_branch...!\n"
git pull origin $current_branch
export LANG=en_US.UTF-8
if [ -f "Podfile" ]; then
echo -e "START POD UPDATE\n"
pod update
else
echo -e "=> POD FILE NOT EXIST! \n"
fi
# Please Stash Dummy Login Infomation And Save It To SourceTree.
# With name {$"fastlogin"}
stashes=`git stash list | grep "fastlogin"`
if [ "$stashes" ]; then
echo "You have the following stashes for this branch: ${stashes}"
# git stash apply $stashes => Bug shellscript sync mutil version stash.
git stash apply stash^{/fastlogin}
fi
PROJECT=$(find . -maxdepth 1 -name "*.xcworkspace" | head -n 1)
if [[ -z "$PROJECT" ]]; then
echo -e "=> No XCode Project Found!\n"
exit 1
else
echo -e "=> Open Repo in XCode: $PROJECT !\n"
open "$PROJECT"
exit 0
fi
@iletai
Copy link
Author

iletai commented Mar 18, 2024

SourceTree custom script to save time with:

  • Fetch and Update the Current Branch
  • Stash Infomation Working
  • Dummy Infomation Loggin Stash
  • Update Pod and Open .xcworkspace

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment