git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Theodore Tso <tytso@mit.edu>
To: Dima Kagan <dima.kagan@gmail.com>
Cc: "Björn Steinbrink" <B.Steinbrink@gmx.de>, git@vger.kernel.org
Subject: Re: Git branches - confusing behavior
Date: Sun, 11 May 2008 10:03:43 -0400	[thread overview]
Message-ID: <20080511140343.GA11248@mit.edu> (raw)
In-Reply-To: <4826EEDF.4010404@gmail.com>

On Sun, May 11, 2008 at 04:04:31PM +0300, Dima Kagan wrote:
> > The uncommitted changes survived the branch change and are still in the
> > working tree, in svn just like in git.
> > 
> 
> Yes, I am aware of that, except one rarely works in one directory on
> multiple svn branches, because the branches are not private. Git's
> branches can be private, so perhaps this behavior should be
> different from SVN?

So if you *want* to use separate working directories for different
branches, you can do that in git too.  Some people find that more
convenient.  Other people don't.  

Keep in mind, the other difference between git and svn is that until
commits are published, they can be freely altered.  So many developers
who use git tend to commit their changes on the "scratch branches",
and then if they need to modify them, use either "git commit --amend"
or "git commit --interactive" as necessary to modify the commits on
the branches until they are just the way they want them.

I will often have several different features "in progress" at
different times, and they are all on scratch branches.  By keeping
them all on scratch branches, I can test them by creating a new
scratch integration branch, and merge the various "in progress"
features together to see how they work together, then go back to the
individual feature branches to clean them up some more.   

When I'm satisified with a particular branch, I'll use "git rebase
master" to rebase the work so that it is based off of the head of the
development branch, and then do a fast forward merge to merge it into
to development branch.

> BTW, Is there a way to do 'svn checkout -b new_branch' into a new directory?

Not as a single step operation, no.  If you put the following in a
script, it will basically do what you want, though.

cp -rl $old_repo $new_repo
cd $new_repo
git checkout $new_branch

It does require that your editor save files by renaming the old file
out of the way to file~ and then writing file as a new file, instead
of opening the existing file and then doing an O_TRUNC (since that
will smash the file on the other repo), but as long as your editor is
hard link friendly, this should work just fine, with minimal disk
space cost.

Or you can just drop the hard link and just copy the whole repostory
using "cp -r" --- after all, svn is horribly wasteful of disk space,
with each repository taking twice the amount of space as the working
directory, and so if you're used to paying that disk overhead cost
with SVN, then presumably you won't mind paying that price with git.
There are smarter ways of working, though, if you don't mind altering
your work flow a little.

    	       		   	     	  - Ted

  parent reply	other threads:[~2008-05-11 14:04 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-11 11:31 Git branches - confusing behavior Dima Kagan
2008-05-11 11:42 ` Jakub Narebski
2008-05-11 11:58   ` Dima Kagan
2008-05-11 12:06     ` David Symonds
2008-05-11 12:11       ` Dima Kagan
2008-05-11 12:13         ` David Symonds
2008-05-11 12:17           ` Dima Kagan
2008-05-11 12:20     ` Steve Frécinaux
     [not found]     ` <f35478f50805110513h15aa462bs9ee35ed4738d3009@mail.gmail.com>
2008-05-11 12:21       ` Dima Kagan
2008-05-11 13:40     ` Jakub Narebski
2008-05-11 12:33   ` Dima Kagan
2008-05-11 12:57     ` Björn Steinbrink
2008-05-11 13:04       ` Dima Kagan
2008-05-11 13:27         ` Björn Steinbrink
2008-05-11 13:39           ` Dima Kagan
     [not found]             ` <4826F72D.2070205-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2008-05-11 15:25               ` Patrick Aljord
2008-05-11 15:39             ` Teemu Likonen
2008-05-12  7:49             ` Miles Bader
2008-05-11 14:03         ` Theodore Tso [this message]
  -- strict thread matches above, loose matches on Subject: below --
2008-06-30  7:23 Matt Seitz (matseitz)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080511140343.GA11248@mit.edu \
    --to=tytso@mit.edu \
    --cc=B.Steinbrink@gmx.de \
    --cc=dima.kagan@gmail.com \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).