Advertisement
Guest User

Untitled

a guest
Jul 9th, 2017
725
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.89 KB | None | 0 0
  1. git-do-the-magic-svn-import-with-history
  2. svn://myserver/path/to/svn/repos
  3. git://myserver/path/to/git/repos
  4.  
  5. $ git svn clone http://svn/repo/here/trunk
  6.  
  7. $ git svn --help
  8.  
  9. user1 = First Last Name <email@address.com>
  10. user2 = First Last Name <email@address.com>
  11. ...
  12.  
  13. svn log --xml | grep "<author>" | sort -u | perl -pe 's/.*>(.*?)<.*/$1 = /' | tee users.txt
  14.  
  15. git svn clone --stdlayout --no-metadata --authors-file=users.txt svn://hostname/path dest_dir-tmp
  16.  
  17. cd dest_dir-tmp
  18. git svn fetch
  19.  
  20. git svn fetch
  21.  
  22. git branch -r
  23.  
  24. git checkout -b local_branch remote_branch
  25. # It's OK if local_branch and remote_branch are the same name
  26.  
  27. git checkout -b tag_v1 remotes/tags/v1
  28. git checkout master
  29. git tag v1 tag_v1
  30. git branch -D tag_v1
  31.  
  32. git clone dest_dir-tmp dest_dir
  33. rm -rf dest_dir-tmp
  34. cd dest_dir
  35.  
  36. git checkout -b local_branch origin/remote_branch
  37.  
  38. git remote rm origin
  39.  
  40. jmaddox = Jon Maddox <jon@gmail.com>
  41. bigpappa = Brian Biggs <bigpappa@gmail.com>
  42.  
  43. mkdir repo && cd repo
  44. git svn init http://subversion/repo --no-metadata
  45. git config svn.authorsfile ~/authors.txt
  46. git svn fetch
  47.  
  48. git svn init file:///home/user/repoName --no-metadata
  49.  
  50. mkdir project
  51. cd project
  52. git svn init http://svn.url
  53.  
  54. git svn fetch -r42
  55.  
  56. git svn rebase
  57.  
  58. gitk
  59.  
  60. git remote add origin git@github.com:user/project-name.git
  61.  
  62. git config branch.master.remote origin
  63. git config branch.master.merge refs/heads/master
  64.  
  65. $ subgit install svn_repos
  66. ...
  67. TRANSLATION SUCCESSFUL
  68.  
  69. $ subgit configure svn_repos
  70. $ edit svn_repos/conf/subgit.conf (change mapping, add authors mapping, etc)
  71. $ subgit install svn_repos
  72.  
  73. # Clone a repo (like git clone):
  74. git svn clone http://svn.foo.org/project -T trunk -b branches -t tags
  75.  
  76. subgit import --svn-url url://svn.serv/Bla/Bla directory/path/Local.git.Repo
  77.  
  78. subgit import directory/path/Local.git.Repo
  79.  
  80. start subgit import --svn-url url://svn.serv/Bla/Bla directory/path/Local.git.Repo
  81.  
  82. start subgit import directory/path/Local.git.Repo
  83.  
  84. $ git remote add origin url://your/repo.git
  85.  
  86. git config --global http.postBuffer 1073741824
  87.  
  88. git push origin --mirror
  89.  
  90. git push origin --all
  91. git push origin --tags
  92.  
  93. #!/usr/bin/env bash
  94. authors=$(svn log -q | grep -e '^r' | awk 'BEGIN { FS = "|" } ; { print $2 }' | sort | uniq)
  95. for author in ${authors}; do
  96. echo "${author} = NAME <USER@DOMAIN>";
  97. done
  98.  
  99. git branch --set-upstream master git-svn
  100. git svn rebase
  101.  
  102. git
  103. git-svn
  104.  
  105. svn log -q | awk -F '|' '/^r/ {sub("^ ", "", $2); sub(" $", "", $2); print $2" = "$2" <"$2">"}' | sort -u > authors-transform.txt
  106.  
  107. jwilkins = jwilkins <jwilkins>
  108.  
  109. jwilkins = John Albin Wilkins <johnalbin@example.com>
  110.  
  111. git svn clone [SVN repo URL] --no-metadata -A authors-transform.txt --stdlayout ~/temp
  112.  
  113. cd ~/temp
  114. git svn show-ignore > .gitignore
  115. git add .gitignore
  116. git commit -m 'Convert svn:ignore properties to .gitignore.'
  117.  
  118. git init --bare ~/new-bare.git
  119. cd ~/new-bare.git
  120. git symbolic-ref HEAD refs/heads/trunk
  121.  
  122. cd ~/temp
  123. git remote add bare ~/new-bare.git
  124. git config remote.bare.push 'refs/remotes/*:refs/heads/*'
  125. git push bare
  126.  
  127. cd ~/new-bare.git
  128. git branch -m trunk master
  129.  
  130. cd ~/new-bare.git
  131. git for-each-ref --format='%(refname)' refs/heads/tags |
  132. cut -d / -f 4 |
  133. while read ref
  134. do
  135. git tag "$ref" "refs/heads/tags/$ref";
  136. git branch -D "tags/$ref";
  137. done
  138.  
  139. $ git remote add origin https://github.com/pankaj0323/JDProjects.git
  140. $ git branch -a
  141. * master
  142. remotes/origin/MyDevBranch
  143. remotes/origin/tags/MyDevBranch-1.0
  144. remotes/origin/trunk
  145. $$ git checkout -b MyDevBranch origin/MyDevBranch
  146. Branch MyDevBranch set up to track remote branch MyDevBranch from origin.
  147. Switched to a new branch 'MyDevBranch'
  148. $ git branch -a
  149. * MyDevBranch
  150. master
  151. remotes/origin/MyDevBranch
  152. remotes/origin/tags/MyDevBranch-1.0
  153. remotes/origin/trunk
  154. $
  155.  
  156. $git checkout origin/tags/MyDevBranch-1.0
  157. Note: checking out 'origin/tags/MyDevBranch-1.0'.
  158. You are in 'detached HEAD' state. You can look around, make experimental
  159. changes and commit them, and you can discard any commits you make in this
  160. state without impacting any branches by performing another checkout.
  161.  
  162. If you want to create a new branch to retain commits you create, you may
  163. do so (now or later) by using -b with the checkout command again. Example:
  164.  
  165. git checkout -b new_branch_name
  166.  
  167. HEAD is now at 3041d81... Creating a tag
  168. $ git branch -a
  169. * (detached from origin/tags/MyDevBranch-1.0)
  170. MyDevBranch
  171. master
  172. remotes/origin/MyDevBranch
  173. remotes/origin/tags/MyDevBranch-1.0
  174. remotes/origin/trunk
  175. $ git tag -a MyDevBranch-1.0 -m "creating tag"
  176. $git tag
  177. MyDevBranch-1.0
  178. $
  179.  
  180. $ git push origin master MyDevBranch MyDevBranch-1.0
  181. Counting objects: 14, done.
  182. Delta compression using up to 8 threads.
  183. Compressing objects: 100% (11/11), done.
  184. Writing objects: 100% (14/14), 2.28 KiB | 0 bytes/s, done.
  185. Total 14 (delta 3), reused 0 (delta 0)
  186. To https://github.com/pankaj0323/JDProjects.git
  187. * [new branch] master -> master
  188. * [new branch] MyDevBranch -> MyDevBranch
  189. * [new tag] MyDevBranch-1.0 -> MyDevBranch-1.0
  190. $
  191.  
  192. $ git remote add origin https://github.com/pankaj0323/JDProjects.git
  193. $ git branch -a
  194. MyDevBranch
  195. * master
  196. remotes/svn/MyDevBranch
  197. remotes/svn/trunk
  198. $ git tag
  199. MyDevBranch-1.0
  200. $ git push origin master MyDevBranch MyDevBranch-1.0
  201.  
  202. git svn clone --username=yourSvnUsername -T trunk_subdir -t tags_subdir -b branches_subdir -r aRevisionNumber svn_url gitreponame
  203.  
  204. cd gitreponame
  205. git svn fetch
  206.  
  207. git svn rebase
  208.  
  209. cp .git/refs/remotes/origin/* .git/refs/heads/
  210.  
  211. 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
  212.  
  213. git remotes add newrepo git@github.com:aUser/aProjectName.git
  214. git push newrepo refs/heads/*
  215. git push --tags newrepo
  216.  
  217. git stash; git svn dcommit ; git stash apply
  218.  
  219. bash
  220. git svn clone --stdlayout --no-metadata -A users.txt
  221. http://svn.domain.com.au/svn/repository/favourite-project
  222. cd favourite-project
  223. git remote add gitlab git@git.domain.com.au:dev-team/favourite-project.git
  224. git push --set-upstream gitlab master
  225.  
  226. /trunk
  227. /Project1
  228. /Project2
  229. /branches
  230. /Project1
  231. /Project2
  232. /tags
  233. /Project1
  234. /Project2
  235.  
  236. /Project1
  237. /trunk
  238. /branches
  239. /tags
  240. /Project2
  241. /trunk
  242. /branches
  243. /tags
  244.  
  245. Ex: ./migration https://svnurl.com/basepath project1
  246.  
  247. Ex: ./migration https://svnurl.com/basepath .
  248.  
  249. git log
  250.  
  251. git remote add origin https://fullurlpathtoyourrepo/reponame.git
  252. git push -u origin --all # pushes up the repo and its refs for the first time
  253. git push -u origin --tags # pushes up any tags
  254.  
  255. #!/bin/bash
  256. file="list.txt"
  257. while IFS= read -r repo_name
  258. do
  259. printf '%sn' "$repo_name"
  260. sudo git svn clone --shared --preserve-empty-dirs --authors-file=users.txt file:///programs/svn/$repo_name
  261. sudo git clone --bare /programs/git/$repo_name $repo_name.git
  262. sudo chown -R www-data:www-data $repo_name.git
  263. sudo rm -rf $repo_name
  264. done <"$file"
  265.  
  266. repo1_name
  267. repo2_name
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement