Last active
          June 2, 2021 13:45 
        
      - 
      
- 
        Save colantuomo/e948aca773be8b289045a1de9f23dde2 to your computer and use it in GitHub Desktop. 
Revisions
- 
        colantuomo revised this gist Jun 2, 2021 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewingThis 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 charactersOriginal file line number Diff line number Diff line change @@ -15,7 +15,6 @@ function smart_checkout() { fi done } ``` #### Get the current branch: @@ -25,4 +24,5 @@ function get_branch() { || echo "default_value" } alias push_origin='git push -u origin "$(get_branch)"' alias clear_branches='git branch | grep -v "master" | xargs git branch -D' 
- 
        colantuomo revised this gist May 27, 2021 . 1 changed file with 4 additions and 3 deletions.There are no files selected for viewingThis 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 charactersOriginal file line number Diff line number Diff line change @@ -1,6 +1,7 @@ ## A List of useful bash scripts for MacOS and Linux #### A smart way to checkout from branches: ```bash function smart_checkout() { git branch @@ -17,7 +18,7 @@ function smart_checkout() { alias push_origin='git push -u origin "$(get_branch)"' ``` #### Get the current branch: ```bash function get_branch() { git branch --no-color | grep -E '^\*' | awk '{print $2}' \ 
- 
        colantuomo revised this gist May 27, 2021 . 1 changed file with 2 additions and 0 deletions.There are no files selected for viewingThis 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 charactersOriginal file line number Diff line number Diff line change @@ -1,3 +1,5 @@ ## A List of usefull bash scripts for MacOS and Linux A smart way to checkout from branches: ```bash function smart_checkout() { 
- 
        colantuomo renamed this gist May 27, 2021 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewingFile renamed without changes.
- 
        colantuomo renamed this gist May 27, 2021 . 1 changed file with 7 additions and 3 deletions.There are no files selected for viewingThis 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 charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,5 @@ A smart way to checkout from branches: ```bash function smart_checkout() { git branch echo "Type part of the branch you want to move?" @@ -11,11 +12,14 @@ function smart_checkout() { fi done } alias push_origin='git push -u origin "$(get_branch)"' ``` Get the current branch: ```bash function get_branch() { git branch --no-color | grep -E '^\*' | awk '{print $2}' \ || echo "default_value" } alias clear_branches='git branch | grep -v "master" | xargs git branch -D' 
- 
        colantuomo renamed this gist May 27, 2021 . 1 changed file with 9 additions and 3 deletions.There are no files selected for viewingThis 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 charactersOriginal file line number Diff line number Diff line change @@ -1,5 +1,4 @@ function smart_checkout() { git branch echo "Type part of the branch you want to move?" @@ -12,4 +11,11 @@ function smart_checkout() { fi done } function get_branch() { git branch --no-color | grep -E '^\*' | awk '{print $2}' \ || echo "default_value" } alias push_origin='git push -u origin "$(get_branch)"' alias clear_branches='git branch | grep -v "master" | xargs git branch -D' 
- 
        colantuomo created this gist May 27, 2021 .There are no files selected for viewingThis 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,15 @@ A easy way to checkout from branchs ```bash function smart_checkout() { git branch echo "Type part of the branch you want to move?" read word for branch in $(git branch); do if [[ $branch == *$word* ]]; then git checkout $branch break; fi done } ```