git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tait <git.git@t41t.com>
To: Thomas Anderson <zelnaga@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: a few beginner git questions
Date: Fri, 5 Mar 2010 23:05:33 -0800	[thread overview]
Message-ID: <20100306070533.GL2480@ece.pdx.edu> (raw)
In-Reply-To: <15b345f1003052242r7d812fe4q6ade253283696304@mail.gmail.com>

> 1. When do you commit changes and when do you stage changes?  Or maybe
> more to the point, what's the difference between doing "stage, commit,
> stage, commit" and "stage, stage, commit"?

Staging changes is a prerequisite to committing them. With stage, commit,
stage, commit you will have two commits in history. With stage, stage,
commit you will have only one commit in history. What you stage (or
neglect to stage) is not part of recorded history in the repository. What
you commit, is.

> 2. What's the difference between merging and pushing?  In CVS, you
> merge code by manually adding changes.  ie. the CVS client doesn't do
> the merging - you do.  Yet in Git Gui, there's a Merge menu button, as
> if it's now supposed to be somehow automated?

Merging is (sort-of) like merging in CVS. You are taking two separate lines
(branches) on the history graph and combining them together. Unlike CVS,
git keeps a record of the merge.

Push is simply copying changes in your local repository to another
repository. What configuration you've set and what arguments you give
to push control what gets copied.

> 3. Creating branches in Git Gui is easy enough but it's unclear to me
> how to switch back to the trunk once you've created a branch.

This depends on what you mean by "switch back". You can change the target
of your commits by using "git checkout".
	> git checkout master
	# Now new commits get added to the tip of master
	> git checkout -b newbranch
	# Now you created a new branch, "newbranch"
	# And you switched to it, so new commits are added
	# to newbranch instead of master
	> git checkout master
	# Now you're back on branch master and your commits
	# to newbranch aren't visible
	> git checkout newbranch
	# Back to newbranch again

If you meant "switch back" like "this branch is done, I'm going to stop
working on it" then you can merge it back into master or some other branch,
or leave it unmerged. Then you may wish to leave it rot or delete it,
perhaps depending on whether you think you'll ever revisit that branch
in the future (to fix a bug, maybe).

> 4. I clone git://github.com/symfony/symfony.git to c:\git\test\root
> and clone that to c:\git\test\clone.	I then blank
> c:\git\test\clone\README, stage it, commit it and push it and the
> change does not appear in c:\git\test\root\README.  I then reopen Git
> Gui and open root and there I see the blanked README as an uncommited
> state change.  I commit it and the change still does not appear in
> c:\git\test\root\README.  Is this what Git should be doing?

You shouldn't push into a non-bare repository (unless you know what you're
doing and really mean it). This:
	http://git.wiki.kernel.org/index.php/GitFaq#Why_won.27t_I_see_changes_in_the_remote_repo_after_.22git_push.22.3F
explains a bit more on the subject.

Tait

  parent reply	other threads:[~2010-03-06  7:17 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-06  6:42 a few beginner git questions Thomas Anderson
2010-03-06  7:01 ` Allan Wind
2010-03-06  7:05 ` Tait [this message]
2010-03-07  2:23   ` Thomas Anderson
2010-03-07  9:08     ` Dmitry Potapov
2010-03-07  5:02   ` Thomas Anderson
2010-03-07  8:50     ` Dmitry Potapov
2010-03-08 18:55     ` Tait
2010-03-07  9:39 ` Junio C Hamano

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=20100306070533.GL2480@ece.pdx.edu \
    --to=git.git@t41t.com \
    --cc=git@vger.kernel.org \
    --cc=zelnaga@gmail.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).