Coder Social home page Coder Social logo

cheat-svn-git's Introduction

git-svn

Create the svn repo

svnadmin create $HOME/svn_repos
svn mkdir --parents file:///$HOME/svn_repos/test_git_svn/{trunk,branches,tags} -m "create project test_svn_git"

Checkout a git and svn working folder

svn co file:///$HOME/svn_repos/test_git_svn/trunk test_svn
git svn clone -s file:///$HOME/svn_repos/test_git_svn test_git

file ops

Add a file in svn -> git

cd $HOME/test_svn
touch a
svn add a
svn commit -m "add a"

cd $HOME/test_git
git svn rebase

Add a file in git- > svn

cd $HOME/test_git
touch b
git add b 
git commit -m "add b"
git svn dcommit 

cd $HOME/test_svn
svn update

revert a commit then push revert to svn

cd $HOME/test_git
git revert HEAD 
git svn decommit

cd $HOME/test_svn
svn update
svn log

branches

branch svn -> git

cd $HOME/test_svn
svn copy  ^/test_git_svn/trunk ^/test_git_svn/branches/branch_a -m "create branch a"
svn switch ^/test_git_svn/branches/branch_a
svn info

cd $HOME/test_git
git svn fetch
git checkout -b branch_a origin/branch_a

branch git -> svn

cd $HOME/test_git
git checkout master
git svn branch branch_b -m "branch b"
git checkout -b branch_b origin/branch_b
git svn info
touch c
git add c 
git commit -m "adding c"
git svn dcommit
git svn info

cd $HOME/test_svn
svn switch ^/test_git_svn/branches/branch_b
echo "verify file c exists"

workflows

local git branch then dcommit the merge commit

Commiting a merge squashed the all the commits on the merged branch

cd $HOME/test_git
git checkout master
git svn branch feature_a -m "feature a"
git checkout -b feature_a origin/feature_a
touch e 
git add e 
git commit e -m "add e"
touch f 
git add f
git commit f -m "add f"
git rebase master
git checkout master
git merge --no-ff feature_a -m "feature a work"
git svn dcommit

cd $HOME/test_svn
svn switch ^/test_git_svn/trunk
svn update
svn log
echo "all commits squashed into one svn commit"

local git branch, rebase, then dcommit linear history

Moving all commits to the target branch to create a linear history

cd $HOME/test_git
git checkout master
git svn branch feature_b -m "feature b"
git checkout -b feature_b origin/feature_b
touch g h
git add g
git commit -m "add g"
git add h 
git commit -m "add h"
git rebase master
git checkout master
git merge --ff-only feature_a -m "feature a work"
git svn dcommit
cd $HOME/test_svn
svn switch ^/test_git_svn/trunk
svn update
svn log
echo "all commits are logged"

cheat-svn-git's People

Contributors

aboseley avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.