Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Add ability to clone out repositories

  • Loading branch information...
commit 4e9a483e5a6cae352a51696deba17b249522eada 1 parent 9f67ed6
Maxim Dobryakov authored
Showing with 76 additions and 41 deletions.
  1. +60 −33 git/git-get
  2. +8 −0 git/mybranch
  3. +8 −8 git/push
93 git/git-get
View
@@ -1,36 +1,63 @@
#!/bin/bash
-export branch=`git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/'`
+get_repository()
+{
+ echo && \
+ echo -e '\033[0;36mClone repository: ' $1 && \
+ echo -e '============================\033[m' && \
+ git clone git@github.com:studiomobile/$1.git && \
+ \
+ cd $1 > /dev/null && \
+ echo && \
+ echo -e '\033[0;36mInit and update submodules' && \
+ echo -e '============================\033[m' && \
+ git submodule init && \
+ git submodule update && \
+ \
+ mybranch && \
+ cd - > /dev/null
+}
-case "$branch" in
- "master")
- echo -e '\033[1;31mYou should *NEVER* git-get from \033[1;32mmaster\033[1;31m branch!\033[m'
- echo -e ''
- echo -e '\033[1;31mConsult your PM if you have problems with it.\033[m'
- ;;
- "")
- echo -e '\033[1;31mMove to git repository before git-get\033[m'
- ;;
- *)
- echo && \
- echo -e '\033[0;36m1. Switching to master branch' && \
- echo -e '============================\033[m' && \
- git checkout master && \
- \
- echo && \
- echo -e '\033[0;36m2. Pulling latest changes from master origin' && \
- echo -e '============================\033[m' && \
- git pull && \
- \
- echo && \
- echo -e '\033[0;36m3. Getting back to private branch' && \
- echo -e '============================\033[m' && \
- git checkout $branch && \
- \
- echo && \
- echo -e '\033[0;36m4. Rebasing your branch on master' && \
- echo -e '============================\033[m' && \
- git rebase master && \
- echo
- ;;
-esac
+get_changes()
+{
+ export branch=`git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/'`
+
+ case "$branch" in
+ "master")
+ echo -e '\033[1;31mYou should *NEVER* git-get from \033[1;32mmaster\033[1;31m branch!\033[m'
+ echo -e ''
+ echo -e '\033[1;31mConsult your PM if you have problems with it.\033[m'
+ ;;
+ "")
+ echo -e '\033[1;31mMove to git repository before git-get or use name of repository to clone it.\033[m'
+ ;;
+ *)
+ echo && \
+ echo -e '\033[0;36mSwitching to master branch' && \
+ echo -e '============================\033[m' && \
+ git checkout master && \
+ \
+ echo && \
+ echo -e '\033[0;36mPulling latest changes from master origin' && \
+ echo -e '============================\033[m' && \
+ git pull && \
+ \
+ echo && \
+ echo -e '\033[0;36mGetting back to private branch' && \
+ echo -e '============================\033[m' && \
+ git checkout $branch && \
+ \
+ echo && \
+ echo -e '\033[0;36mRebasing your branch on master' && \
+ echo -e '============================\033[m' && \
+ git rebase master && \
+ echo
+ ;;
+ esac
+}
+
+if [ "$#" -eq 1 ] ; then
+ get_repository $1
+else
+ get_changes
+fi
8 git/mybranch
View
@@ -0,0 +1,8 @@
+#!/bin/bash
+
+export user=`whoami`
+
+echo && \
+echo -e '\033[0;36mCreate branch: ' $user && \
+echo -e '============================\033[m' && \
+git checkout -b $user
16 git/push
View
@@ -20,41 +20,41 @@ case "$branch" in
;;
*)
echo && \
- echo -e '\033[0;36m1. Switching to master branch' && \
+ echo -e '\033[0;36mSwitching to master branch' && \
echo -e '============================\033[m' && \
git checkout master && \
\
echo && \
- echo -e '\033[0;36m2. Pulling latest changes from master origin' && \
+ echo -e '\033[0;36mPulling latest changes from master origin' && \
echo -e '============================\033[m' && \
git pull && \
\
echo && \
- echo -e '\033[0;36m3. Getting back to private branch' && \
+ echo -e '\033[0;36mGetting back to private branch' && \
echo -e '============================\033[m' && \
git checkout $branch && \
\
echo && \
- echo -e '\033[0;36m4. Rebasing your branch on master' && \
+ echo -e '\033[0;36mRebasing your branch on master' && \
echo -e '============================\033[m' && \
git rebase master && \
\
echo && \
- echo -e '\033[0;36m5. Returning to master branch' && \
+ echo -e '\033[0;36mReturning to master branch' && \
echo -e '============================\033[m' && \
git checkout master && \
\
echo && \
- echo -e '\033[0;36m6. Merging your changes with master' && \
+ echo -e '\033[0;36mMerging your changes with master' && \
echo -e '============================\033[m' && \
git merge $branch && \
echo && \
- echo -e '\033[0;36m7. Pushing your changes from master to origin' && \
+ echo -e '\033[0;36mPushing your changes from master to origin' && \
echo -e '============================\033[m' && \
git push && \
\
echo && \
- echo -e '\033[0;36m8. Getting back to private branch' && \
+ echo -e '\033[0;36mGetting back to private branch' && \
echo -e '============================\033[m' && \
git checkout $branch && \
echo
Please sign in to comment.
Something went wrong with that request. Please try again.