Created
June 27, 2016 08:00
-
-
Save qinshulei/64eababeccd76c11906eccf0399cbfd7 to your computer and use it in GitHub Desktop.
create_branch_in_pure_git.sh
This 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 characters
| #!/bin/bash | |
| for i in $(ls | grep git);do | |
| echo $i; | |
| cd $i; | |
| git show-ref | grep remotes | while read LINE;do | |
| echo $LINE | |
| version=$(echo ${LINE} | awk 'BEGIN { FS = " " } ; { print $1 }'); | |
| branch_name=$(echo ${LINE} | awk 'BEGIN { FS = " " } ; { print $2 }'); | |
| echo "version : ""${version}"; | |
| echo "branch name : ""${branch_name}"; | |
| if [ -n version -a -n branch_name ];then | |
| git branch -f $(basename ${branch_name}) ${version} | |
| fi | |
| done | |
| cd .. ; | |
| done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment