From: Jakub Narebski <jnareb@gmail.com>
To: hogsolo <greg@localdirt.com>
Cc: git@vger.kernel.org
Subject: Re: Basic Git usage
Date: Sat, 14 Aug 2010 05:39:16 -0700 (PDT) [thread overview]
Message-ID: <m3hbix2wss.fsf@localhost.localdomain> (raw)
In-Reply-To: <1281760358285-5422412.post@n2.nabble.com>
hogsolo <greg@localdirt.com> writes:
> Hi, Im new to Git, formerly an SVN user.
>
> I have a master repo and have created a branch. I want to work in both at
> the same time. I want to change some files in the master, then switch to the
> branch ( git checkout branchname) , work on some files, then switch back to
> the master.
>
> However git wont let me switch back to the master until I have added,
> committed and pushed my files in the branch.
>
> Is this correct behavior for git? It would seem that I not be REQUIRED to
> check in anything I was working on before switching between branch and
> master, but that's the behavior I'm seeing via error messages.
Git wouldn't allow you to switch a branch ('git checkout <branch>') if
you have uncomitted changes that would conflict with the branch you
switch to. For example if you have uncomitted changes to file 'foo',
and this file is different on the branch you switch to, then git rightly
refuses to switch branches.
You can tell git to try to merge changes with
git checkout -m <branch>
or you can force git to discard your local changes with
git checkout -f <branch>
or you can stash away your changes before switching branch.
In no case _pushing_ changes is a requirement.
--
Jakub Narebski
Poland
ShadeHawk on #git
next prev parent reply other threads:[~2010-08-14 12:39 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-08-14 4:32 Basic Git usage hogsolo
2010-08-14 12:39 ` Jakub Narebski [this message]
2010-08-14 19:41 ` Dmitry Potapov
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=m3hbix2wss.fsf@localhost.localdomain \
--to=jnareb@gmail.com \
--cc=git@vger.kernel.org \
--cc=greg@localdirt.com \
/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).