Differences

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

Link to this comparison view

dev:using_git [2009/11/25 23:04]
hjunes git svn was too slow. delete the experiment.
dev:using_git [2018/02/07 17:07]
Line 1: Line 1:
-Before continuing to read this page, you have two options: 
-  - If you are happy with using svn, stop reading here. 
-  - If you would like to experiment with git, continue reading. 
- 
-This page has been benefited a lot from the following pages: 
-  * [[http://​www.viget.com/​extend/​effectively-using-git-with-subversion/​|Effectively Using Git With Subversion]] 
- 
-=====Installing git===== 
- 
-Install first git and a graphical client (e.g. gitk) for it 
-<​code>​ 
-sudo apt-get install git gitk 
-</​code>​ 
- 
-=====Applying git clone to the svn repository===== 
-Create the following ''​git-clone-rg-repository.sh''​ script in order to clone the repository 
-<​code>​ 
-#!/bin/bash 
-USERNAME=<​username>​ 
-ERROR_CODE=-1 
-while [ $ERROR_CODE -ne 0 ]; do 
-  # repeat until final success 
-  git svn clone -s https://​${USERNAME}@rosegarden.svn.sourceforge.net/​svnroot/​rosegarden rosegarden.git 
-  # it may be possible that the commands ends to an error like 'RA layer request failed:'​ 
-  let ERROR_CODE=$?​ 
-  # just a small pause before repeating the command 
-  sleep 1 
-done 
-echo Finished. 
-</​code>​ 
-The clone the repository (takes a long, long time (several, or, even tens of hours) and 662 Mb to fetch all branches) by running the script 
-<​code>​ 
-bash ./​git-clone-rg-repository.sh 
-</​code>​ 
-If the script still fails, end the loop by pressing Ctrl+C and rerun the script. 
- 
-=====Example commit 1: Generating .gitignore and adding it to the subversion repository===== 
-(These lines have already been executed once.) 
- 
-==== Generating .gitignore ==== 
- 
-Generate the ignore file with 
-<​code>​ 
-cd rosegarden.git 
-git-svn show-ignore > .gitignore 
-</​code>​ 
- 
-==== Adding file to a following local commit ==== 
- 
-Add the generated file to the local commit 
-<​code>​ 
-git add .gitignore 
-</​code>​ 
-and check the status of the repository, if you wish 
-<​code>​ 
-git status 
-</​code>​ 
-the following lines will result 
-<​code>​ 
-# On branch master ​                                         
-# Changes to be committed: ​                                 
-#   (use "git reset HEAD <​file>​..."​ to unstage) ​           ​ 
-#                                                          ​ 
-#       new file:   ​.gitignore ​                             
-#    ​ 
-</​code>​ 
- 
-==== Committing locally ==== 
- 
-Commit locally the changes 
-<​code>​ 
-git commit .gitignore 
-</​code>​ 
-write then the comment 
-<​code>​ 
-Add .gitignore file as a result of the following command: 
- git svn show-ignore > .gitignore 
-</​code>​ 
-after writing the comment, save the file in editor and finally quit the editor. 
-This will commit locally the changes and the following information will be given 
-<​code>​ 
-Created commit 4dcfaa7: Add .gitignore file as a result of the following command: 
- 1 files changed, 181 insertions(+),​ 0 deletions(-) ​                             ​ 
- ​create mode 100644 .gitignore ​                                                   
-</​code>​ 
- 
-==== Fetching latest changes before commit ==== 
- 
-Before committing, you want make sure that you have the latest version of the source 
-<​code>​ 
-git svn rebase 
-</​code>​ 
-Invoking the above command 
-  - reverts temporarily the changes you have made 
-  - downloads all changes from subversion, ​ 
-  - applies the downloaded changes from subversion to the previous version downloaded from subversion, and 
-  - applies again the changes you have made. 
-The following lines will be printed 
-<​code>​ 
-First, rewinding head to replay your work on top of it...                        ​ 
-Applying: Add .gitignore file as a result of the following command: ​             ​ 
-</​code>​ 
- 
-==== Committing back to subversion ==== 
- 
-Suggesting that there were no code to merge and no conflicts to solve, you can then commit back to subversion 
-<​code>​ 
-git svn dcommit 
-</​code>​ 
-You will see then the following output 
-<​code>​ 
-Committing to https://​hjunes@rosegarden.svn.sourceforge.net/​svnroot/​rosegarden/​trunk ... 
-        A       ​.gitignore ​                                                             ​ 
-Committed r10792 ​                                                                       ​ 
-        A       ​.gitignore ​                                                             ​ 
-r10792 = 8d3f93067b542f7e770c08a3e84c8fb4bb8fb46f (trunk) ​                               
-No changes between current HEAD and refs/​remotes/​trunk ​                                 ​ 
-Resetting to the latest refs/​remotes/​trunk ​                                             ​ 
-</​code>​ 
-As you can see, the commit has been assigned subversion'​s version number 10792. 
- 
-===== A typical short working cycle ===== 
- 
-First you check for new updates 
-<​code>​ 
-git svn rebase 
-</​code>​ 
- 
-Then you make your changes, compile and test 
-<​code>​ 
-[... editing ...] 
-make 
-./​rosegarden 
-</​code>​ 
- 
-Now lets prepare for the commit. First lets see what changes we are going to commit 
-<​code>​ 
-git diff 
-</​code>​ 
- 
-Add files which were changed and commit them locally 
-<​code>​ 
-git add [file1 file2 ...] 
-git commit -m "​Message..."​ 
-</​code>​ 
- 
-Then one more check for probable new set of changes 
-<​code>​ 
-git svn rebase 
-</​code>​ 
-No merge was needed in this example. 
- 
-Finally, submit the changes 
-<​code>​ 
-git svn dcommit 
-</​code>​ 
- 
-That was it. The above set of commands is not optimal, but it works. 
- 
-===== Using TEMPORARILY a branch ===== 
- 
-First you may want to **fetch** (the code word) the changes in all branches 
-<​code>​ 
-git svn fetch 
-</​code>​ 
- 
- 
  
 
 
dev/using_git.txt ยท Last modified: 2018/02/07 17:07 (external edit)
Recent changes RSS feed Creative Commons License Valid XHTML 1.0 Valid CSS Driven by DokuWiki