Code Monkey home page Code Monkey logo

git-to-svn-guide's Introduction

Git to SVN :(

Some useful information can be found at svnbook.red-bean.com.

1. Create A Local Working Copy

$ svn checkout BRANCH FOLDER_NAME

1.1 Example

# Checks out repo/trunk in a folder called trunk
$ svn checkout https://code.example.com/repo/trunk

# Checks out repo/trunk in a folder called repo
$ svn checkout https://code.example.com/repo/trunk repo

1.2 Git Equivalent

$ git clone REPO

2. Create A New Branch

$ svn copy CURRENT_BRANCH NEW_BRANCH -m "MESSAGE"

2.1 Example

$ svn copy https://code.example.com/repo/trunk \
    https://code.example.com/repo/features/feature_branch \
    -m "Creating a private branch of /repo/trunk."

2.2 Git Equivalent

$ git checkout -b BRANCH

3. Switch To a Different Branch

$ svn switch BRANCH

3.1 Example

$ svn switch https://code.example.com/repo/features/feature_branch

3.2 Git Equivalent

$ git checkout BRANCH

4. Keep The Branch In Sync

$ svn update

4.1 Example

$ svn switch https://code.example.com/repo/trunk
$ svn update
$ svn switch https://code.example.com/repo/features/feature_branch
$ svn merge https://code.example.com/repo/trunk
& svn ci -m "Merge branch trunk into feature_branch"

4.2 Git Equivalent

$ git pull

5. Merge to Trunk

$ svn merge BRANCH

5.1 Example

$ svn switch https://code.example.com/repo/trunk
$ svn update
$ svn merge --reintegrate https://code.example.com/repo/features/my_feature
$ svn update
$ svn commit -m "Merge branch my_feature into trunk"

5.2 Git Equivalent

$ git merge BRANCH

6. Status

$ svn status

6.1 Git Equivalent

$ git status

7. Committing

$ svn commit -m "MESSAGE"

7.1 Example

$ svn update
$ svn status
$ svn add PATH/TO/NEW/FILES
$ svn commit -m "Added an awesome feature"

7.2 Git Equivalent

$ git commit -m "Added an awesome feature" && git push

8. Commit A Single File

$ svn commit FILE -m "MESSAGE"

8.1 Example

$ svn commit app/models/awesome.rb -m "Adding some awesome"

9. View Repository Structure

$ svn ls REPO

9.1 Example

$ svn ls https://code.example.com/repo
branches/
features/
tags/
trunk/

$ svn ls https://code.example.com/repo/features
sprint_17/
sprint_18/
sprint_19/

9.2 Git Equivalent

$ git branch -a

10. View Repository Details

$ svn info

11. Revert Changes

 $ svn revert

11.1 Example

$ svn revert . -R
$ svn revert /PATH/TO/FILE

11.2 Git Equivalent

$ git checkout /PATH/TO/FILE

12. List latest revision

$ svn log

12.1 Example

$ svn log /PATH/TO/FILE -v -l3

12.2 Git Equivalent

$ git log -n 3

13. View diff of a commit

$ svn log --diff

13.1 Example

$ svn log -r 42256 --diff

13.2 Git Equivalent

$ git diff 29461219405dcdee17194d0e3112f160e1345d49

14. Merge Conflicts

Accept whatever the current directory structure is at this time:

$ svn resolve --accept working . -R

15. The "Git Way"

15.1 Clone Trunk

$ svn checkout https://code.example.com/repo/trunk repo

15.2 Create Feature Branch

$ svn copy https://code.example.com/repo/trunk \
    https://code.example.com/repo/features/feature_branch \
    -m "Creating a private branch of /repo/trunk."

15.3 Switch

$ svn switch https://code.example.com/repo/features/feature_branch

15.4 Make Changes

$ rm *.php
$ rails new awesome_app

15.5 Add New Files

$ svn status
$ svn add . --force

15.6 Commit New Files

$ svn commit -m "Made some awesome"

15.7 Switch to Trunk

$ svn switch https://code.example.com/repo/trunk

15.8 Update From Upstream

$ svn update

15.9 Merge New Feature

$ svn merge --reintegrate https://code.example.com/repo/features/feature_branch 

15.10 Commit Merge

$ svn commit -m "Merge branch feature_branch into trunk"

git-to-svn-guide's People

Contributors

garethrees avatar ijoseph avatar ryanoasis avatar samknight avatar zzl0 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

git-to-svn-guide's Issues

proposed

git checkout a file
git stash
.gitignore --> to ignore one file or file recursively (already tracking/ non tracking)
git reset
git show
git diff comit_id1 commit_id2

This would be a neat command line tool

Would be a neat command line tool to just map the git commands to their svn equivalent.

alias gsvn checkout = svn switch
alias gsvn pull = svn update

Compare to HEAD vs BASE

  • BASE will compare what you have now to what you had when you started
  • HEAD will compare what you have now to what's in the repo at this point in time

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.