Created
October 12, 2012 15:27
-
-
Save ferventcoder/3879765 to your computer and use it in GitHub Desktop.
Git SVN Setup
This file contains 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
[alias] | |
spull = !git checkout master && git svn rebase | |
spush = !git checkout master && git svn dcommit | |
work = !git checkout work && git rebase master | |
prepwork = !git checkout work && git rebase master && git checkout master && git merge work |
This file contains 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
SET URL=%1 | |
SET FOLDERNAME=%2 | |
::http://stackoverflow.com/a/2348596/18475 | |
git svn clone -r HEAD %URL% %FOLDERNAME% | |
::The above is a single branch or the trunk. If you want all of them, adjust your url accordingly and use this instead: | |
::git svn clone --stdlayout -r HEAD %URL% %FOLDERNAME% |
This file contains 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
$scriptDir = $(Split-Path -parent $MyInvocation.MyCommand.Definition) | |
function Install-NeededFor { | |
param( | |
[string] $packageName = '' | |
,[bool] $defaultAnswer = $true | |
) | |
if ($packageName -eq '') {return $false} | |
$yes = '6' | |
$no = '7' | |
$msgBoxTimeout='-1' | |
$defaultAnswerDisplay = 'Yes' | |
$buttonType = 0x4; | |
if (!$defaultAnswer) { $defaultAnswerDisplay = 'No'; $buttonType= 0x104;} | |
$answer = $msgBoxTimeout | |
try { | |
$timeout = 10 | |
$question = "Do you need to install $($packageName)? Defaults to `'$defaultAnswerDisplay`' after $timeout seconds" | |
$msgBox = New-Object -ComObject WScript.Shell | |
$answer = $msgBox.Popup($question, $timeout, "Install $packageName", $buttonType) | |
} | |
catch { | |
} | |
if ($answer -eq $yes -or ($answer -eq $msgBoxTimeout -and $defaultAnswer -eq $true)) { | |
write-host "Installing $packageName" | |
return $true | |
} | |
write-host "Not installing $packageName" | |
return $false | |
} | |
#install chocolatey | |
if (Install-NeededFor 'chocolatey') { | |
iex ((new-object net.webclient).DownloadString("http://bit.ly/psChocInstall")) | |
} | |
if (Install-NeededFor 'gitextensions') { | |
cinst gitextensions | |
} |
This uses a shallow clone, which means is doesn't take forever. This is also meant to pull against a single branch or the trunk. If one wants to pull against all branches, and the trunk, one needs to call git svn clone --stdlayout -r HEAD URL FOLDERNAME
Also, a pretty neat tool out there is Git Standup - written by @AnthonyMastrean - you may need to adjust the author for git-svn checkins
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Workflow is:
git spull
. This will shift you over to master and pull all of the remote svn commits you don't have. You must not have anything uncommitted at this point.git work
to have your teammates' commits applied to work before your changes.git prepwork
to get the changes all into master. Callgit spull
one more time to be sure there are no more incoming commits. Then callgit spush
to push those changes up to your teammates and the build server.