[Digikam-devel] Re: how to use git as subversion

Marcel Wiesweg marcel.wiesweg at gmx.de
Sun Feb 6 19:43:52 GMT 2011


> 
> I'm really lost with git. It's complex to understand.

:-)

This tutorial gives 1:1 translations for SVN commands:
http://git.or.cz/course/svn.html

As you already found out, git is not svn.
With git, your local clone is complete. With "git commit -a" you commit to 
your local repository. As a second step, you push your changes to the remote 
repository. You can collect commits, even commit offline, before pushing.

The equivalent to "svn up" is "git pull". Not quite - the equivalent is "git 
pull --rebase". The default, non-rebase will instead do a merge of your local 
commits. Now if you have understood what I am talking about, you know enough 
about git!
If not, you'll do in a month. Until then, I recommend to 
git config --global alias.up "pull --rebase"
and then just type "git up" from now on. It's better for the occasional local 
commit.

> I don't want to manage branch in local and all complex situations. By
> experience, it's dangerous...

With git, branches are just so much easier. But I dont want to encourage 
private branches, development should be in the open after all.

> 
> Typically, i would to continue to work with git as subversion.
> 
> repository is cloned. No problem.
> 
> now, i change a change, and i want to "commit" my changes in KDE
> repository as like "svn ci". I perform "git commit"... git ask
> comment. fine. In comment i set CCBUGS in comment but nothing append
> in bugzilla. So i'm not sure that changes are commited.

You need to "git push"... Commit is local so far.
Start up "gitk". You'll see that your local branch, "2.0", contains the 
commit, while the remote branch does not yet.

> 
> To be sure, i delete my changed files (moves in another place in fact)
> and i want to perform "svn up" as well. I try "git pull", but git said
> that there is nothing to do. All is already updated...
> 
> ARGGGGG... file are deleted !
> 
> "git diff" said that files have been removed... but i'm not able to restore
> it.

To undo local changes, use "git checkout", usually "git  checkout HEAD <some 
paths>".
To reset local (unpushed) commits, use "git reset". There are some flavors: --
hard, --mixed or --soft. Never use this with pushed commits though...
Side note: To amend another change to a local commit, use "git commit --
amend". You cannot amend an already pushed commit.

> 
> I'm lost. I thinking that git is not perfect for me, or i'm not
> adapted to git (:=)))...

You are not adapted. And nothing is perfect ;-)



More information about the Digikam-devel mailing list