Loading...
 

Git concepts for SVN users

When moving to Git from SVN, there are some conceptual conflicts that causes a lot of troubles on daily work. This document intends to describe some basic differences between SVN and Git, so SVN users can learn faster and probably avoid problems.

1. Decentralized vs. Centralized workflow

The first big difference between Git and SVN is Git makes possible to have decentralized workflow when collaborating to other developers, while SVN is fully centralized.

On decentralized workflow you can duplicate (fork) a git repository, share this repository with friends while the original has it's own activity. It is also possible to send differences from duplicated repository to the original and fetch differences from original as well.

On centralized workflow, every change needs to be committed to a unique remote repository. Despite the fact you can have SVN mirrors, it is still centralized, because mirrors also get/send changes from/to central repository.

Getting trunk branch on SVN
svn co https://svn.code.sf.net/p/tikiwiki/code/trunk tikiwiki

Getting trunk branch on Git
git clone git@gitlab.com:tikiwiki/tiki.git tikiwiki

2. Commit, Pull, Push

When working on SVN workflow, every commit goes directly to SVN server and will be available to other developers when they update their working copies.

But on Git it is very different. When you initialize a git folder, you will have your project files on your working space, a new local Git repository at the root of your project and optionally, a remote repository, like we have on Github or Gitlab.

When you commit your changes using Git, these changes will be saved only in your local repository. To make your commits available to other devs, you have to *push* your changes to a remote repository. Also, if you want to get changes from other devs and apply on your working space, you have to *pull* these changes from remote repository.

Committing on SVN
echo 'my new change in a file' > README
svn add README
svn ci -m '[FIX] Added changes on README'

Committing on Git
echo 'my new change in a file' > README
git add README
git commit -m '[FIX] Added changes on README'

# It is possible to commit more changes before sending to remote.
# After done, just push changes to remote repository
git push

3. Branching

To create branches on SVN, you have to create a branch on remote repository as well, so your team mates can have access to your branch. There is no way to create a local branch for testing purposes.

On Git, you create a branch in your local repository. Optionally, this branch can be sent to remote repository, with an extra command for that.

Creating SVN branch
svn copy 'https://svn.code.sf.net/p/tikiwiki/code/trunk'  'https://svn.code.sf.net/p/tikiwiki/code/branches/task-icon-picker'
svn co 'https://svn.code.sf.net/p/tikiwiki/code/branches/task-icon-picker' tiki-icon-picker

Creating Git branch
git branch task-icon-picker
git checkout task-icon-picker

# The last command created a branch on local repository,
# so, to send it to remote repository
git push -u origin task-icon-picker

4. Mark files to be committed

On SVN, if you have several changes on working space and try to commit that without specifying a file, all those changes will be committed.

But on Git, the behavior is different. You have to mark a file, folder or the entire working copy to be committed and then create the commit to save your changes.

Adding files to commit on SVN
svn add README.html
svn ci -m '[NEW] HTML version for README'

Adding files to commit on Git
git add README.html
git commit -m '[NEW] HTML version for README'

# But if there is no new files and the mission is commit all changes
# just use the -a option
git commit -a -m '[NEW] HTML version for README'

5. Revert and discard changes

On SVN, when you want to discard changes on your working copy, you use the command revert to discard those changes and start again.

But on Git, the concept to discard changes is different. You take the content of your local repository and copy over files on you working copy. So the changes is discard. The revert on Git has other meaning.

The revert command on Git creates a commit that undo things of other commit. So, if you added a line on a file and committed that, the revert command will create another commit removing the line on that file.

Discarding changes SVN
echo 'My new line on README' >> README
svn revert README

Reverting a revision on SVN
svn merge -c-63929 README

Discarding changes on Git
echo 'My new line on README' >> README
git checkout README

Reverting a commit on Git
git revert 4543a31466d48

Created by Fabio Montefuscolo. Last Modification: Tuesday 21 August, 2018 10:41:33 GMT-0000 by luciash d' being.

Keywords

The following is a list of keywords that should serve as hubs for navigation within the Tiki development and should correspond to documentation keywords.

Each feature in Tiki has a wiki page which regroups all the bugs, requests for enhancements, etc. It is somewhat a form of wiki-based project management. You can also express your interest in a feature by adding it to your profile. You can also try out the Dynamic filter.

Accessibility (WAI & 508)
Accounting 7.x
Administration
Ajax 2.x
Articles & Submissions
Backlinks
Banner
Batch 6.x
BigBlueButton audio/video/chat/screensharing (5.x)
Blog
Bookmark
Browser Compatibility
Calendar
Category
Chat
Comment
Communication Center
Consistency
Contacts Address book
Contact us
Content template
Contribution 2.x
Cookie
Copyright
Credits 6.x
Custom Home (and Group Home Page)
Database MySQL - MyISAM
Database MySQL - InnoDB
Date and Time
Debugger Console
Directory (of hyperlinks)
Documentation link from Tiki to doc.tiki.org (Help System)
Docs 8.x
DogFood
Draw 7.x
Dynamic Content
Preferences
Dynamic Variable
External Authentication
FAQ
Featured links
Feeds (RSS)
File Gallery
Forum
Friendship Network (Community)
Group
Help
History
Hotword
HTML Page
i18n (Multilingual, l10n, Babelfish)
Image Gallery
Import-Export
Install
Integrator
Interoperability
Inter-User Messages
InterTiki
jQuery
Kaltura video management
Karma
Live Support
Logs (system & action)
Lost edit protection
Mail-in
Map
Menu
Meta Tag
Missing features
Visual Mapping 3.x
Mobile Tiki and Voice Tiki
Mods
Modules
MultiTiki
MyTiki
Newsletter
Notepad
OS independence (Non-Linux, Windows/IIS, Mac, BSD)
Organic Groups (Self-managed Teams)
Packages
Payment 5.x
PDF
Performance Speed / Load / Compression / Cache
Permission
Poll
Profiles
Quiz
Rating
Realname
Report
Revision Approval
Scheduler
Score
Search engine optimization (SEO)
Search
Security
Semantic links 3.x
Share
Shopping Cart 5.x
Shoutbox
Site Identity
Slideshow
Smarty Template
Social Networking
Spam protection (Anti-bot CATPCHA)
Spellcheck
Spreadsheet
Staging and Approval
Stats
Survey
Syntax Highlighter (Codemirror)
Tablesorter
Tags 2.x
Task
Tell a Friend, alert + Social Bookmarking
Terms and Conditions
Theme
TikiTests 2.x
Timesheet
Token Access
Toolbar (Quicktags)
Tours
Trackers
TRIM
User Administration
User Files
User Menu
Watch
WebHelp
Webmail and Groupmail
WebServices 3.x
Wiki 3D
Wiki History, page rename, etc
Wiki plugins extends basic syntax
Wiki syntax text area, parser, etc
Wiki structure (book and table of content)
Workspace and perspectives 4.x
WYSIWTSN 4.x
WYSIWYCA
WYSIWYG 2.x
XMLRPC
XMPP




Useful Tools