User Tools

Site Tools


sourceforge:git

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Last revision Both sides next revision
sourceforge:git [2018/04/21 18:08]
karl Add git svn log, fix several typos
sourceforge:git [2018/04/22 12:38]
karl Add rebase command, more splits into headlines
Line 1: Line 1:
 ====== Git ====== ====== Git ======
  
-Git is a revision control system, just like rcs, cvs and [[svn]] are. \\+Git is a revision control system, just like rcs, cvs and [[svn|subversion (SVN)]] are. \\
 Though the Crossfire repository is maintained by svn, it is possible to access this svn repo with git. \\ Though the Crossfire repository is maintained by svn, it is possible to access this svn repo with git. \\
-The svn package needs to be installed though, since it has bindings for PERL because git-svn is a perl script.+The subversion ​package needs to be installed though, since it has bindings for PERL because git-svn is a perl script ​located in {prefix}/​libexec/​git-core ​.
  
 ===== Prerequisites == ===== Prerequisites ==
Line 23: Line 23:
 Inside a new created directory then run these commands : Inside a new created directory then run these commands :
 <code bash> <code bash>
-git svn clone -r 1 https://​svn.code.sf.net/​p/​crossfire/​code ;echo $?+git svn clone -r 1 svn://​svn.code.sf.net/​p/​crossfire/​code ;echo $?
 </​code>​ </​code>​
 Which should print to the terminal Which should print to the terminal
->​Initialized empty Git repository in /​mnt/​sdb16/​CROSSFIRE/​client_svn/​git_experiments/​code/​.git/​+>​Initialized empty Git repository in /​mnt/​sdb16/​CROSSFIRE/​svn/​git_experiments/​code/​.git/​
 >W: +empty_dir: trunk >W: +empty_dir: trunk
 >r1 = a967a85ee09bcf27915ff5eb652a10a7dc0d4a89 (refs/​remotes/​git-svn) >r1 = a967a85ee09bcf27915ff5eb652a10a7dc0d4a89 (refs/​remotes/​git-svn)
 >Checked out HEAD: >Checked out HEAD:
->  ​https://​svn.code.sf.net/​p/​crossfire/​code r1+>  ​svn:%%//%%svn.code.sf.net/​p/​crossfire/​code r1
 >​creating empty directory: trunk >​creating empty directory: trunk
 >0 >0
-And create a directory "​code"​ with a hidden .git folder structure.+And create a directory "​code"​ with a hidden .git/ folder and a trunk/ ​folder structure. 
 + 
 +Inside the **.git** folder there is a file named **config** which should look like 
 +<code conf> 
 +[core] 
 + repositoryformatversion = 0 
 + filemode = true 
 + bare = false 
 + logallrefupdates = true 
 +[svn-remote "​svn"​] 
 + url = svn://​svn.code.sf.net/​p/​crossfire/​code 
 + fetch = :​refs/​remotes/​git-svn 
 +</​code>​
  
 Now it needs to change into the new '​code'​ directory : Now it needs to change into the new '​code'​ directory :
Line 40: Line 52:
 </​code>​ </​code>​
  
-Now run git svn log :+Then run git svn log and git log:
 <code bash> <code bash>
  git svn log                     git svn log                   
Line 49: Line 61:
  
 ------------------------------------------------------------------------ ------------------------------------------------------------------------
 +
 + git log
 +commit c03bc89287c20c60c8d52377771046f54166d4eb (HEAD -> master)
 +Author: (no author) <(no author)@282e977c-c81d-0410-88c4-b93c2d0d6712>​
 +Date:   Mon Mar 29 04:46:48 1999 +0000
 +
 +    New repository initialized by cvs2svn.
 +    ​
 +    git-svn-id: svn://​svn.code.sf.net/​p/​crossfire/​code@1 282e977c-c81d-0410-88c4
 +-b93c2d0d6712
 </​code>​ </​code>​
  
 +===== git svn fetch -r 2 svn ==
 Inside this code directory we start to "​fetch"​ revision by revision : Inside this code directory we start to "​fetch"​ revision by revision :
 <code bash> <code bash>
  git svn fetch -r 2 svn;echo $?  git svn fetch -r 2 svn;echo $?
 + A trunk/​arch/​spell/​rod_light.111.xpm
 + A trunk/​arch/​spell/​rod_light.arc
 + A trunk/​arch/​spell/​rod_light.112.xpm
 + A trunk/​arch/​spell/​rod_light.113.xpm
 + A trunk/​arch/​spell/​rod_heavy.111
 +
 + A trunk/​arch/​dev/​README
 + A trunk/​arch/​dev/​xpm.template
 +r2 = e8b6556cff76da629a33f2f20c5e3388df081fca (refs/​remotes/​git-svn)
 +Auto packing the repository in background for optimum performance.
 +See "git help gc" for manual housekeeping.
 +0
 </​code>​ </​code>​
 +
 +When you get errors like
 >W: Ignoring error from SVN, path probably does not exist: (175002): RA layer request failed: REPORT request >on '/​p/​crossfire/​code/​!svn/​rvr/​2'​ failed >W: Ignoring error from SVN, path probably does not exist: (175002): RA layer request failed: REPORT request >on '/​p/​crossfire/​code/​!svn/​rvr/​2'​ failed
 >W: Do not be alarmed at the above message git-svn is just searching aggressively for old history. >W: Do not be alarmed at the above message git-svn is just searching aggressively for old history.
 >This may take a while on large repositories >This may take a while on large repositories
 >0hecked through r2 >0hecked through r2
 +then maybe change the .git/config entry value for the key '​url'​ from https: to svn: \\
 +''​url = https:​%%//​%%svn.code.sf.net/​p/​crossfire/​code''​ -> ''​url = svn:​%%//​%%svn.code.sf.net/​p/​crossfire/​code''​ .
  
  
-And then the files start to appear with revision 3 :+When the fetch has finished, then run git svn log :
 <code bash> <code bash>
-git svn fetch -r 3 svn;echo $? +git svn log 
- A trunk/​arch/​gods/​supernatural/​valriel.arc +-----------------------------------------------------------------------
- A trunk/​arch/​gods/​supernatural/​devourers.arc +r2 | uid200 | 1999-03-29 03:46:48 -0100 (Mon, 29 Mar 1999) | 2 lines 
- A trunk/​arch/​gods/​supernatural/​gorokh.arc + 
- A trunk/​arch/​gods/​elemental/​ruggilli.111 +Initial revision 
- A trunk/​arch/​gods/​elemental/​ruggilli.211 + 
- A trunk/​arch/​gods/​elemental/​ruggilli.112 +------------------------------------------------------------------------ 
- A trunk/​arch/​skills/​singing.arc+r1 | (no author) | 1999-03-29 03:46:48 -0100 (Mon, 29 Mar 1999) | 2 lines 
 + 
 +New repository initialized by cvs2svn. 
 + 
 +------------------------------------------------------------------------
 </​code>​ </​code>​
  
 +===== git svn rebase -l ==
 +The downloaded files are still kept inside the data pack files; \\
 +to make them show up it needs to rebase locally :
 +<code bash>
 +  git svn rebase -l
 +
 +First, rewinding head to replay your work on top of it...
 +Fast-forwarded master to refs/​remotes/​git-svn.
 +</​code>​
 +Now the trunk/arch folder has some files to view .
 +
 +**Note**: Do not forget the **-l** option for rebase; without that option it would rebase against the HEAD of the svn tree, \\
 +downloading all the 20000+ revisions !
 +
 +And ''​git log''​ tells us :
 +<code bash>
 + git log
 +commit e8b6556cff76da629a33f2f20c5e3388df081fca (HEAD -> master, git-svn)
 +Author: uid200 <​uid200@282e977c-c81d-0410-88c4-b93c2d0d6712>​
 +Date:   Mon Mar 29 04:46:48 1999 +0000
 +
 +    Initial revision
 +    ​
 +    ​
 +    git-svn-id: svn://​svn.code.sf.net/​p/​crossfire/​code@2 282e977c-c81d-0410-88c4-b
 +93c2d0d6712
 +
 +commit c03bc89287c20c60c8d52377771046f54166d4eb
 +Author: (no author) <(no author)@282e977c-c81d-0410-88c4-b93c2d0d6712>​
 +Date:   Mon Mar 29 04:46:48 1999 +0000
 +
 +    New repository initialized by cvs2svn.
 +    ​
 +    git-svn-id: svn://​svn.code.sf.net/​p/​crossfire/​code@1 282e977c-c81d-0410-88c4-b93c2d0d6712
 +</​code>​
sourceforge/git.txt · Last modified: 2018/04/22 17:02 by karl