Git For Subversion Users Page 2

ADVERTISEMENT

GIT FOR SUBVERSION USERS
Branching & Tagging
Everything else is taken care of for you: you can merge two
branches as often as you like, don’t have to specify any revisions
and can expect the operation to be blazingly fast if you’re merging
In contrast to Subversion, Git doesn’t use directories to manage
two local branches.
branches. Instead, it uses a more powerful and lightweight approach.
As you might have already noticed, the
git status
command
If a merge conflict should occur, Git will already update the rest
also informs you about which branch you are currently working on.
of the working copy to the new state. After resolving a conflicted
And in Git, you are always working on a branch!
file, you can mark it using the
git add
command.
SVN
$ svn copy
SUBVERSION
$ svn resolved <file>
GIT
GIT
$ git add <file>
$ git branch <new-branch>
To switch to a different branch and make it active (then also
Sharing & Collaborating
referred to as the HEAD branch), the
git checkout
command
is used. Because switching can take some time in Subversion, it’s
To download & integrate new changes from a remote server, you
not unusual to instead have multiple working copies on your disk.
git pull
use the
command.
In Git, this would be extremely uncommon: since operations are
very fast, you only keep a single local repository on your disk.
SUBVERSION
$ svn update
SUBVERSION
$ svn switch
GIT
$ git pull
GIT
If you only want to download & inspect remote changes (before
$ git checkout <branch>
git fetch
integrating them), you can use
. Later, you can
integrate the downloaded changes via
git merge
.
git
branch|
Listing all available local branches just requires the
command without further arguments.
GIT
$ git fetch
SVN
$ svn list
In Subversion, data is automatically uploaded to the central server
when committing it. In Git, however, this is a separate step. This
GIT
$ git branch
means you can decide for yourself if and when you want to share
git push
your work. Once you’re ready, the
command will upload
Creating tags is just as quick & cheap as creating branches.
the changes from your currently active branch to the remote
branch you specify.
SVN
$ svn copy
GIT
$ git push <remote> <branch>
GIT
$ git tag -a <tag-name>
Your teammates, too, will publish their work like this on a remote
(with the
git push
command). If you want to start working on
such a branch, you need to create your own local copy of it. You can
Merging Changes
git checkout
--track
use the
command with the
option to do
just that: create a local version of the specified remote branch.
Like in newer versions of SVN, you only need to provide the branch
You can later share the additional commits you’ve made at any
git merge
you want to integrate to the
command.
git push
time with the
command, again.
SUBVERSION
SUBVERSION
$ svn merge -r REV1:REV2
$ svn switch
<other-branch>
$ svn merge
(or in newer SVN versions)
GIT
<other-branch>
$ git checkout --track <remote>/<branch>
GIT
$ git merge <other-branch>
30-day free trial available at
the most powerful Git client for Mac

ADVERTISEMENT

00 votes

Related Articles

Related forms

Related Categories

Parent category: Education
Go
Page of 2