Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- git-do-the-magic-svn-import-with-history
- svn://myserver/path/to/svn/repos
- git://myserver/path/to/git/repos
- $ git svn clone http://svn/repo/here/trunk
- $ git svn --help
- user1 = First Last Name <email@address.com>
- user2 = First Last Name <email@address.com>
- ...
- svn log --xml | grep "<author>" | sort -u | perl -pe 's/.*>(.*?)<.*/$1 = /' | tee users.txt
- git svn clone --stdlayout --no-metadata --authors-file=users.txt svn://hostname/path dest_dir-tmp
- cd dest_dir-tmp
- git svn fetch
- git svn fetch
- git branch -r
- git checkout -b local_branch remote_branch
- # It's OK if local_branch and remote_branch are the same name
- git checkout -b tag_v1 remotes/tags/v1
- git checkout master
- git tag v1 tag_v1
- git branch -D tag_v1
- git clone dest_dir-tmp dest_dir
- rm -rf dest_dir-tmp
- cd dest_dir
- git checkout -b local_branch origin/remote_branch
- git remote rm origin
- jmaddox = Jon Maddox <jon@gmail.com>
- bigpappa = Brian Biggs <bigpappa@gmail.com>
- mkdir repo && cd repo
- git svn init http://subversion/repo --no-metadata
- git config svn.authorsfile ~/authors.txt
- git svn fetch
- git svn init file:///home/user/repoName --no-metadata
- mkdir project
- cd project
- git svn init http://svn.url
- git svn fetch -r42
- git svn rebase
- gitk
- git remote add origin git@github.com:user/project-name.git
- git config branch.master.remote origin
- git config branch.master.merge refs/heads/master
- $ subgit install svn_repos
- ...
- TRANSLATION SUCCESSFUL
- $ subgit configure svn_repos
- $ edit svn_repos/conf/subgit.conf (change mapping, add authors mapping, etc)
- $ subgit install svn_repos
- # Clone a repo (like git clone):
- git svn clone http://svn.foo.org/project -T trunk -b branches -t tags
- subgit import --svn-url url://svn.serv/Bla/Bla directory/path/Local.git.Repo
- subgit import directory/path/Local.git.Repo
- start subgit import --svn-url url://svn.serv/Bla/Bla directory/path/Local.git.Repo
- start subgit import directory/path/Local.git.Repo
- $ git remote add origin url://your/repo.git
- git config --global http.postBuffer 1073741824
- git push origin --mirror
- git push origin --all
- git push origin --tags
- #!/usr/bin/env bash
- authors=$(svn log -q | grep -e '^r' | awk 'BEGIN { FS = "|" } ; { print $2 }' | sort | uniq)
- for author in ${authors}; do
- echo "${author} = NAME <USER@DOMAIN>";
- done
- git branch --set-upstream master git-svn
- git svn rebase
- git
- git-svn
- svn log -q | awk -F '|' '/^r/ {sub("^ ", "", $2); sub(" $", "", $2); print $2" = "$2" <"$2">"}' | sort -u > authors-transform.txt
- jwilkins = jwilkins <jwilkins>
- jwilkins = John Albin Wilkins <johnalbin@example.com>
- git svn clone [SVN repo URL] --no-metadata -A authors-transform.txt --stdlayout ~/temp
- cd ~/temp
- git svn show-ignore > .gitignore
- git add .gitignore
- git commit -m 'Convert svn:ignore properties to .gitignore.'
- git init --bare ~/new-bare.git
- cd ~/new-bare.git
- git symbolic-ref HEAD refs/heads/trunk
- cd ~/temp
- git remote add bare ~/new-bare.git
- git config remote.bare.push 'refs/remotes/*:refs/heads/*'
- git push bare
- cd ~/new-bare.git
- git branch -m trunk master
- cd ~/new-bare.git
- git for-each-ref --format='%(refname)' refs/heads/tags |
- cut -d / -f 4 |
- while read ref
- do
- git tag "$ref" "refs/heads/tags/$ref";
- git branch -D "tags/$ref";
- done
- $ git remote add origin https://github.com/pankaj0323/JDProjects.git
- $ git branch -a
- * master
- remotes/origin/MyDevBranch
- remotes/origin/tags/MyDevBranch-1.0
- remotes/origin/trunk
- $$ git checkout -b MyDevBranch origin/MyDevBranch
- Branch MyDevBranch set up to track remote branch MyDevBranch from origin.
- Switched to a new branch 'MyDevBranch'
- $ git branch -a
- * MyDevBranch
- master
- remotes/origin/MyDevBranch
- remotes/origin/tags/MyDevBranch-1.0
- remotes/origin/trunk
- $
- $git checkout origin/tags/MyDevBranch-1.0
- Note: checking out 'origin/tags/MyDevBranch-1.0'.
- You are in 'detached HEAD' state. You can look around, make experimental
- changes and commit them, and you can discard any commits you make in this
- state without impacting any branches by performing another checkout.
- If you want to create a new branch to retain commits you create, you may
- do so (now or later) by using -b with the checkout command again. Example:
- git checkout -b new_branch_name
- HEAD is now at 3041d81... Creating a tag
- $ git branch -a
- * (detached from origin/tags/MyDevBranch-1.0)
- MyDevBranch
- master
- remotes/origin/MyDevBranch
- remotes/origin/tags/MyDevBranch-1.0
- remotes/origin/trunk
- $ git tag -a MyDevBranch-1.0 -m "creating tag"
- $git tag
- MyDevBranch-1.0
- $
- $ git push origin master MyDevBranch MyDevBranch-1.0
- Counting objects: 14, done.
- Delta compression using up to 8 threads.
- Compressing objects: 100% (11/11), done.
- Writing objects: 100% (14/14), 2.28 KiB | 0 bytes/s, done.
- Total 14 (delta 3), reused 0 (delta 0)
- To https://github.com/pankaj0323/JDProjects.git
- * [new branch] master -> master
- * [new branch] MyDevBranch -> MyDevBranch
- * [new tag] MyDevBranch-1.0 -> MyDevBranch-1.0
- $
- $ git remote add origin https://github.com/pankaj0323/JDProjects.git
- $ git branch -a
- MyDevBranch
- * master
- remotes/svn/MyDevBranch
- remotes/svn/trunk
- $ git tag
- MyDevBranch-1.0
- $ git push origin master MyDevBranch MyDevBranch-1.0
- git svn clone --username=yourSvnUsername -T trunk_subdir -t tags_subdir -b branches_subdir -r aRevisionNumber svn_url gitreponame
- cd gitreponame
- git svn fetch
- git svn rebase
- cp .git/refs/remotes/origin/* .git/refs/heads/
- git for-each-ref refs/remotes/origin/tags | sed 's#^.*([[:xdigit:]]{40}).*refs/remotes/origin/tags/(.*)$#2 1#g' | while read p; do git tag -m "tag from svn" $p; done
- git remotes add newrepo git@github.com:aUser/aProjectName.git
- git push newrepo refs/heads/*
- git push --tags newrepo
- git stash; git svn dcommit ; git stash apply
- bash
- git svn clone --stdlayout --no-metadata -A users.txt
- http://svn.domain.com.au/svn/repository/favourite-project
- cd favourite-project
- git remote add gitlab git@git.domain.com.au:dev-team/favourite-project.git
- git push --set-upstream gitlab master
- /trunk
- /Project1
- /Project2
- /branches
- /Project1
- /Project2
- /tags
- /Project1
- /Project2
- /Project1
- /trunk
- /branches
- /tags
- /Project2
- /trunk
- /branches
- /tags
- Ex: ./migration https://svnurl.com/basepath project1
- Ex: ./migration https://svnurl.com/basepath .
- git log
- git remote add origin https://fullurlpathtoyourrepo/reponame.git
- git push -u origin --all # pushes up the repo and its refs for the first time
- git push -u origin --tags # pushes up any tags
- #!/bin/bash
- file="list.txt"
- while IFS= read -r repo_name
- do
- printf '%sn' "$repo_name"
- sudo git svn clone --shared --preserve-empty-dirs --authors-file=users.txt file:///programs/svn/$repo_name
- sudo git clone --bare /programs/git/$repo_name $repo_name.git
- sudo chown -R www-data:www-data $repo_name.git
- sudo rm -rf $repo_name
- done <"$file"
- repo1_name
- repo2_name
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement