Wireshark-dev: Re: [Wireshark-dev] How about moving from svn to git?
From: Sébastien Tandel <sebastien.tandel@xxxxxxxxx>
Date: Sun, 8 Nov 2009 22:08:36 -0200
Hi Guy,


The way I work is that I have multiple "working trees" for various
projects, with modified versions of various source files. 

different working trees with svn is synonym of having several repositories on the local FS. With git, you can create local branches which could represent your different working trees.

creation of a branch :
git checkout -b <new-branch> <orig-branch>

branch switching :
git checkout <branch>

Oh BTW, everything is by default local with git. Therefore creating a branch will stay local until you decide to push it to the central repository. That's why git is sooo better in terms of performance than cvs/svn and others. git diff, log, status are local. *git commit* is local. You don't need network to work with your SCM. Everything is local except "git pull" and "git push".


For Wireshark, I do "svn update" on occasion, resolve the conflicts
myself, and check the code in when it's "done".

For libpcap and tcpdump, which now use Git, that's not so easy, as I
don't check in my work until it's "done", and then push it.  "git
pull" gets upset when I've modified files; it doesn't work the way
"cvs update" and "svn update" work.

One way to do this is to keep master clean and creating a branch "per feature". This way you can pull to the master and merge into your branches (or master).


I presume "git stash" is one of the tools to be used in this case,
with a "git stash save" before "git pull" and a "git stash pop"
after.

 When I tried that, it appeared to do a local commit of the
work done so far;
git stash creates a temporary commit object without affecting the tree of commits. And it sets the state of your working tree to the last commit (not the one created by git stash ;))! To convince you, you can do a git log after a git stash save and it should not appear in the logs.

if I then do more work and another "git commit",
will both of those commits get pushed individually, or do they get
pushed as one single commit to the remote repository?  I'd prefer the
latter, as there's no point in exposing individual checkpoints for
work I've done in the history on the remote repository.

Therefore, if you do "another git commit" after the git stash pop, it will be considered as one single commit. But if you do it before git stash pop, the modifications "saved" by git stash save won't be even taken into account!

(Currently, I work around it by diffing my tree, backing out my
changes, doing a "git pull", and then reapplying my changes.  That's
the Git tool I *really* want, but I don't have time to become a
porcelain craftsman....)

That's painful :)


Regards,
Sebastien Tandel