From a0cafdc320731bbd227b1d8433b51bbad2537b66 Mon Sep 17 00:00:00 2001 From: Andrei Jiroh Eugenio Halili Date: Tue, 6 Apr 2021 18:13:45 +0800 Subject: [PATCH] repo: Update README and even update some scripts Signed-off-by: Andrei Jiroh Eugenio Halili --- README.md | 16 +++++++++++----- bin/add-upstream-remote | 2 +- bin/rename-branch | 35 +++++++++++++++++++++++++++++++++++ 3 files changed, 47 insertions(+), 6 deletions(-) create mode 100755 bin/rename-branch diff --git a/README.md b/README.md index 25d450a..1516fdd 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ working at The Pins Team, see [our dotfiles][df-gl]. ## Getting Started -### Using the bootstraper script +### Using the bootstraper script without cloning ```sh ## configure required variables @@ -21,12 +21,18 @@ $(command -v curl>>/dev/null && echo curl -o- || echo wget -q0-) https://raw.git unset GH_USERNAME GH_PAT ``` +### With Cloning the Repo + +```sh + +``` + ## Want to fork me owo? -Follow the checklist below after forking to ensure no -references to mine are found. **Remember that your fork, -your problem.** It's up to you on how do you customize -stuff. +Follow the checklist below after forking to ensure no references to mine are found. **Remember that your fork, your problem.** It's +up to you on how do you customize stuff. You can use [The Pins Team's dotfiles template][template] to start from our template. + +[template]: https://github.com/MadeByThePinsHub/dotfiles-template * [ ] Customize the `bootstrap-linux.sh` into your needs. * [ ] Delete any existing dotfiles I made (e.g. `*.gitconfig`, `*.bashrc`, etc.) and do `bin/backup-dotfiles`. That script will move your current config into your `.dotfiles` local repo and do soft links. diff --git a/bin/add-upstream-remote b/bin/add-upstream-remote index 909e698..1628409 100755 --- a/bin/add-upstream-remote +++ b/bin/add-upstream-remote @@ -5,7 +5,7 @@ if [[ -f "$PWD/.git/config" ]] && [[ $1 != "" ]]; then git remote --verbose add upstream $UPSTREAM_REPO_URL || git remote --verbose set-url upstream $UPSTREAM_REPO_URL git fetch --all elif [[ ! -f "$PWD/.git/config" ]]; then - echo "Is this an git repository? I doubt." + echo "Is this an git repository? I doubt." && exit 1 else echo "Usage: ${0} " fi diff --git a/bin/rename-branch b/bin/rename-branch new file mode 100755 index 0000000..1c57eaf --- /dev/null +++ b/bin/rename-branch @@ -0,0 +1,35 @@ +#!/usr/bin/env bash + +doCheckStatusHere() { + GIT_STATUS=$(echo $?) + + if [[ $GIT_STATUS != "0" ]]; then + echo "error: Failed to run because it exited with a non-zero code." + exit 1 + else + return 0 + fi +} + +if [[ $1 != "" && $2 == "" ]]; then + OLD_BRANCH_NAME=$(git rev-parse --abbrev-ref HEAD) + NEW_BRANCH_NAME=$1 + + # we're gonna do some error handling here + git status>>/dev/null + doCheckStatusHere + + git branch -m $NEW_BRANCH_NAME + git push -u origin $NEW_BRANCH_NAME + echo "info: I didn't delete the old branch name, just in case you need it." + echo "info: To delete the old branch both locally and in remote, run the following command:" + echo "info: git branch --d $OLD_BRANCH_NAME && git push origin :$OLD_BRANCH_NAME " + exit +elif [[ $GIT_STATUS == "0" ]] && [[ $1 != "" && $2 != "" ]]; then + echo $1 && echo $2 + exit +elif [[ $GIT_STATUS != "1" ]]; then + echo "error: Is this an git repository? I doubt." && exit 1 +else + echo "Usage: ${0} [target-branch-optionally-to-rename" +fi