-*- outline -*-* Setup git.** Debian.For Etch Degian release use git-core package from backports,old 1.4 version of git very dumb compared to new version 1.5. $ sudo apt-get install git-coreAfter install setup some options: $ git config --global user.name "Oleksandr Gavenko" $ git config --global user.mail "gavenkoa@gmail.com" $ cat ~/.gitconfig[user] name = Oleksandr Gavenko mail = gavenkoa@gmail.com** Windows.No official support for Windows OS.*** Cygwin.*** MSys.Native port. $ cat gitconfig[core]autocrlf = falsesymlinks = false http://code.google.com/p/msysgit* Start your project.Setup proj space on fs. $ mkdir proj $ cd proj $ git initInitialized empty Git repository in /home/user/tmp/proj/.git/ $ ls -a. .. .gitAdd file, make changes, commit all. $ emacs Makefile... C-x C-c $ emacs app.c... C-x C-c $ git add Makefile app.c $ git status# On branch master## Initial commit## Changes to be committed:# (use "git rm --cached <file>..." to unstage)## new file: Makefile# new file: app.c#or just $ git add .Commit newlly added file: $ git commit... Write message log ...Created initial commit 2169263: My first commit massage. 1 files changed, 4 insertions(+), 0 deletions(-) create mode 100644 app.c* Undo tracking added file.You do $ git add badfile $ git status# On branch master# Changes to be committed:# (use "git reset HEAD <file>..." to unstage)## new file: badfile#To stop tracking badfile do $ git rm --cached badfile $ git status# On branch master# Untracked files:# (use "git add <file>..." to include in what will be committed)## filenothing added to commit but untracked files present (use "git add" to track)or $ git reset badfile* Doing changes. $ printf "clean:\n<TAB>rm $(wildcard *.o)" >>Makefile $ git diffdiff --git a/Makefile b/Makefileindex e84f7e9..cd2438a 100644--- a/Makefile+++ b/Makefile@@ -1,2 +1,5 @@ all: @echo XXX exit 1++clean:+ rm -f *.o\ No newline at end of file $ git add Makefile $ git commit -m "Added clean target."Created commit 11272b9: Added clean target. 1 files changed, 1 insertions(+), 0 deletions(-) create mode 100644 fileor just $ git commit -a -m "Added clean target."* Using git to work with SVN offline.Prepare SVN and git utilities: $ sudo apt-get svn git-core git-svnMaking SVN repo $ cd $HOME/tmp $ svnadmin create svn-repo $ svn co file://$HOME/tmp/svn-repo svn-devel $ cd svn-devel $ mkdir tags trunk branches $ svn add *A branchesA tagsA trunk $ cd trunk/ $ printf "all:\n echo XXX\n" >Makefile $ printf "int main() {return 0;}" >main.c $ svn add * $ cd .. $ svn stA trunkA trunk/main.cA trunk/MakefileA branchesA tags $ svn ci -m initAdding branchesAdding tagsAdding trunkAdding trunk/MakefileAdding trunk/main.cTransmitting file data .. $ svn cp -m v0.0 file://$HOME/tmp/svn/trunk file://$HOME/tmp/svn/tags/v0.0 $ svn cp -m v0.1 file://$HOME/tmp/svn/trunk file://$HOME/tmp/svn/branches/v0.1Moving SVN changset to git repo $ cd $HOME/tmp $ git svn init file://$HOME/tmp/svn git-repo $ ls -a. .. .git $ git svn fetch A trunk/main.c A trunk/MakefileW: +empty_dir: branchesW: +empty_dir: tagsr1 = 52ccd9882979dd53ec198dbac108783ec660410f (git-svn) A tags/v0.0/main.c A tags/v0.0/Makefiler2 = 8ec8a772bb6f37ace56b3649066dc84e481ed427 (git-svn) M trunk/Makefiler3 = 2c169ff409ed504dd6a092b1e302beb3fd94871e (git-svn) A branches/v0.1/main.c A branches/v0.1/Makefiler4 = e68d76f4ba6beea4b9059c1884c1f38ce10831a7 (git-svn) M trunk/Makefiler5 = cdde63974454b13ac53f2eeb201aa76c49fd875c (git-svn)Checked out HEAD: file:///home/sasha/tmp/svn r5or (in old git version): $ git svn clone file://$HOME/tmp/svn git-repoMaking changes in svn: $ cd $HOME/tmp/svn-devel/trunk $ echo ".PHONY: clean" >>Makefile $ svn ci -m "Added clean to phony."Sending trunk/MakefileTransmitting file data .Committed revision 6.Making committed in git: $ cd $HOME/tmp/git-repo/trunk $ echo ".PHONY: all" >>Makefile $ echo "int foo(int x) {return x+x;}" >>main.c $ git status# On branch master# Changed but not updated:# (use "git add <file>..." to update what will be committed)## modified: Makefile# modified: main.c#no changes added to commit (use "git add" and/or "git commit -a") $ git commit -a -m "Bug fixed."Created commit 222d399: Bug fixed. 2 files changed, 2 insertions(+), 0 deletions(-)Getting changes from SVN to git: $ git svn rebase M trunk/Makefiler6 = 8165e9bfb38e9df09a7313d19606ec227629b670 (git-svn)First, rewinding head to replay your work on top of it...Applying Bug fixed.error: patch failed: trunk/Makefile:6error: trunk/Makefile: patch does not applyUsing index info to reconstruct a base tree...Falling back to patching base and 3-way merge...Auto-merged trunk/MakefileCONFLICT (content): Merge conflict in trunk/MakefileFailed to merge in the changes.Patch failed at 0001.When you have resolved this problem run "git rebase --continue".If you would prefer to skip this patch, instead run "git rebase --skip".To restore the original branch and stop rebasing run "git rebase --abort".rebase refs/remotes/git-svn: command returned error: 1 $ git add Makefile $ git rebase --continueApplying Bug fixed.and return all from git to SVN: $ git svn dcommitCommitting to file:///home/sasha/tmp/svn ... M trunk/Makefile M trunk/main.cCommitted r7 M trunk/main.c M trunk/Makefiler7 = 68e782c8d06635f2db4dd69b9ca8599f99da22e2 (git-svn)No changes between current HEAD and refs/remotes/git-svnResetting to the latest refs/remotes/git-svnSee what going to SVN repo: $ cd $HOME/tmp/svn-devel/trunk $ svn diff -r BASE:HEADIndex: Makefile===================================================================--- Makefile (working copy)+++ Makefile (revision 7)@@ -6,4 +6,4 @@ .o: .c $(CC) $(CFLAGS) -c -o $@ $<-.PHONY: clean+.PHONY: all cleanIndex: main.c===================================================================--- main.c (working copy)+++ main.c (revision 7)@@ -2,3 +2,4 @@ { return 0; }+int foo(int x) {return x+x;} $ svn upU MakefileU main.cUpdated to revision 7.* gitkgitk - The git repository browserInstalling: $ sudo apt-get instal gitkUsing: $ cd /path/to/git-repo $ gitkSee gitk(1)