Created
June 20, 2014 20:20
-
-
Save DeveloperInfra/571046a2e5ac104302f3 to your computer and use it in GitHub Desktop.
BASH script to push multiple existing projects
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 | |
### My use case may be unique. We have 152 projects that we are transferring from VSS and SVN to Git. | |
### We don’t care about the prior source control history. We are starting fresh with the most recent | |
### version of each project. | |
for i in * ; do ### For each item in the active directory | |
if [ -d "$i" ]; then ### If the item is a folder | |
echo | |
DIR=$(basename "$i") ### Get the basename of the folder | |
read -p "Process $DIR (y/n)? " -n 1 -r ### Confirm you want to process the current folder | |
echo | |
if [ "$REPLY" = "y" ]; then | |
echo $DIR | clip ### Copy the folder name to the clipboard | |
cd $DIR | |
read -p "remote origin url: " URL ### Prompt for the clone URL | |
git init | |
git remote add origin $URL | |
git add . | |
git commit -m 'Initial commit from prior source control system.' | |
git push -u origin master | |
git status | |
cd .. | |
fi | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment