Skip to contentSkip to conversation

cvs-migration document: make the need for "push" more obvious

PATCH In review J. Bruce Fields 8 participants 38 messages Aug 11, 2016 11 messages not in the archive Documentation

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

#4 lore raw

PATCH 1/1 cvs-migration document: make the need for "push" more obvious

It really is an important concept to grasp for people coming from CVS. Even if it is briefly mentioned, it is not obvious enough to sink in.

---

On Wed, 6 Dec 2006, Werner LEMBERG wrote:

> It took me a while to realize that a git repository, as soon as > you've cloned it, is *self-contained*, and that commiting to the > repository and synchronizing with a different git repository are > two completely different things (contrary to CVS). This should > be pronounced more in the CVS->git guide.

 Documentation/cvs-migration.txt |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)
Documentation/cvs-migration.txt +5 -0
index 6812683..8e610c7 100644
@@ -24,6 +24,11 @@ First, note some ways that git differs from CVS:
     single shared repository which people can synchronize with; see below
     for details.
 
+  * Since every working tree contains a repository, a commit will not
+    publish your changes; it will only create a revision. You have to
+    "push" your changes to a public repository to make them visible
+    to others.
+
 Importing a CVS archive
 -----------------------
 
#5 lore raw

Documentation/cvs-migration.txt First, note some ways that git differs from CVS: · line 31

Quoted 5 lines · Johannes Schindelin
Documentation/cvs-migration.txt +5 -0
+  * Since every working tree contains a repository, a commit will not
+    publish your changes; it will only create a revision. You have to
+    "push" your changes to a public repository to make them visible
+    to others.
+

I'm not sure about context of this addition, but it is simply not true if you publish your working repository. Granted, usually one sets up bare public publishing repository...

By publish I mean set up http(s):// or git://, or ssh+git://, or local transport.

Signature · 3 lines
Jakub Narebski
Warsaw, Poland
ShadeHawk on #git
#6 lore raw
Quoted 11 lines · Jakub Narebski

Documentation/cvs-migration.txt First, note some ways that git differs from CVS: · line 31

Quoted 5 lines · Johannes Schindelin
Documentation/cvs-migration.txt +5 -0
+  * Since every working tree contains a repository, a commit will not
+    publish your changes; it will only create a revision. You have to
+    "push" your changes to a public repository to make them visible
+    to others.
+

I'm not sure about context of this addition, but it is simply not true if you publish your working repository. Granted, usually one sets up bare public publishing repository...

That's true, but this document is focused on the cvs-like case of multiple private repos pushing to a single common public repo.

But we could replace "a commit will not publish" by "a commit in your private repository will not publish"--which would make the statement true without distracting from the main point.

#7 lore raw
In reply to Jakub Narebski

Hi,

Quoted 10 lines · Jakub Narebski

Documentation/cvs-migration.txt First, note some ways that git differs from CVS: · line 31

Quoted 5 lines · Johannes Schindelin
Documentation/cvs-migration.txt +5 -0
+  * Since every working tree contains a repository, a commit will not
+    publish your changes; it will only create a revision. You have to
+    "push" your changes to a public repository to make them visible
+    to others.
+

I'm not sure about context of this addition, but it is simply not true if you publish your working repository.

Remember, you are talking to CVS users. They are not dumb, but sooo used to the CVS ways. So, they do not publish their working directory.

Later, when they became familiar with Git, you can tell them: "BTW you can also publish your working directory, but then you have to be extra careful with git-commit --amend, and if you allow pushing into your repo you have to add hooks to prevent updating your current HEAD, etc."

Give them a chance to get used to the concepts of Git.

Ciao,
Dscho

#8 lore raw

Hi!

Quoted 9 lines · Johannes Schindelin
Quoted 7 lines · Jakub Narebski

Documentation/cvs-migration.txt First, note some ways that git differs from CVS: · line 31

Quoted 5 lines · Johannes Schindelin
Documentation/cvs-migration.txt +5 -0
+  * Since every working tree contains a repository, a commit will not
+    publish your changes; it will only create a revision. You have to
+    "push" your changes to a public repository to make them visible
+    to others.
+

I'd perhaps add here that it doesn't "push" your changes to a repository you cloned from / you fetch from.

Quoted 5 lines
Quoted 2 lines

I'm not sure about context of this addition, but it is simply not true if you publish your working repository.

Remember, you are talking to CVS users. They are not dumb, but sooo used to the CVS ways. So, they do not publish their working directory.

So we are talking in context of having CVS-like one central repository from which they pull / fetch, and to which they push?

Quoted 4 lines

Later, when they became familiar with Git, you can tell them: "BTW you can also publish your working directory, but then you have to be extra careful with git-commit --amend, and if you allow pushing into your repo you have to add hooks to prevent updating your current HEAD, etc."

I'd rather say that "publish your working repository", not "working directory" here.

Quoted 1 line

Give them a chance to get used to the concepts of Git.

Well, it would be best to teach them concepts of git along.

Signature · 1 line
Jakub Narebski
#9 lore raw

New users, was Re: [PATCH] cvs-migration document: make the need for "push" more obvious

Hi,

Quoted 5 lines · Jakub Narebski
Quoted 1 line · Johannes Schindelin

Give them a chance to get used to the concepts of Git.

Well, it would be best to teach them concepts of git along.

NOOOOO!

It might surprise you that most users are not at all interested in how Git works. They just want to use the thing. And we should not try to make life hard on them. Teach them what they have to know _as quickly as possible_ so that they can continue to work. They'll come back for more.

If you make it as complicated as Malbolge to them, you will never know you lost a happy camper, because they _will not tell you_!

Ciao,
Dscho

#10 lore raw
In reply to Johannes Schindelin

Johannes Schindelin escreveu:

Quoted 3 lines

It really is an important concept to grasp for people coming from CVS. Even if it is briefly mentioned, it is not obvious enough to sink in.

I think the goal is laudable, but IMO it would be better to shorten the document rather adding more text.

here is my try

From 980a0ca1b274e1219c24c3138f95e42206c72875 Mon Sep 17 00:00:00 2001
From: Han-Wen Nienhuys <[email protected]>
Date: Wed, 6 Dec 2006 15:50:13 +0100
Subject: [PATCH] another try at rephrasing cvs doc.

---
 Documentation/cvs-migration.txt |   34 +++++++++++++++++++++++-----------
 1 files changed, 23 insertions(+), 11 deletions(-)
Documentation/cvs-migration.txt +23 -11
index 6812683..3270c57 100644
@@ -6,24 +6,36 @@ this document is to put you on the road to recovery, by helping you
 convert an existing cvs repository to git, and by showing you how to use a
 git repository in a cvs-like fashion.
 
-Some basic familiarity with git is required.  This
-link:tutorial.html[tutorial introduction to git] should be sufficient.
-
-First, note some ways that git differs from CVS:
+Git differs from CVS:
 
   * Commits are atomic and project-wide, not per-file as in CVS.
 
-  * Offline work is supported: you can make multiple commits locally,
+  * Branching is fast and easy.
+
+  * GIT is a distributed version control system:
+    This has several consequences:
+
+    - Every working tree contains a repository with a full copy of the
+    project history.
+    
+    - Offline work is supported: you can create revisions locally,
     then submit them when you're ready.
 
-  * Branching is fast and easy.
+    Hence, there is a difference between creating a revision
+    (the "commit" command) and submitting it (the "push" command).
+
+    - No repository is inherently more important than
+    any other.
+    
+    Of course, a project may still designate one central repository as
+    the True Master that contributors synchronize with.
+
+    See below for details.
 
-  * Every working tree contains a repository with a full copy of the
-    project history, and no repository is inherently more important than
-    any other.  However, you can emulate the CVS model by designating a
-    single shared repository which people can synchronize with; see below
-    for details.
+Some basic familiarity with git is required.  This
+link:tutorial.html[tutorial introduction to git] should be sufficient.
 
+    
 Importing a CVS archive
 -----------------------
 
Signature · 4 lines
1.4.4.1.gc9922-dirty


-- 
#11 lore raw
Quoted 7 lines · Han-Wen Nienhuys

Johannes Schindelin escreveu:

Quoted 3 lines

It really is an important concept to grasp for people coming from CVS. Even if it is briefly mentioned, it is not obvious enough to sink in.

I think the goal is laudable, but IMO it would be better to shorten the document rather adding more text.

OK, but...

Quoted 2 lines
 Documentation/cvs-migration.txt |   34 +++++++++++++++++++++++-----------
 1 files changed, 23 insertions(+), 11 deletions(-)

... that lengthens it even more than the proposed addition.

Documentation/cvs-migration.txt this document is to put you on the road to recovery, by helping you · line 25

Quoted 2 lines
Documentation/cvs-migration.txt +2 -0
+    Hence, there is a difference between creating a revision
+    (the "commit" command) and submitting it (the "push" command).

I'd rather leave that introduction as it is--just as a section that advertises the git features without trying to explain much. And I'd rather not mention push until we have a chance to explain how to use it.

#12 lore raw

Hi,

Quoted 3 lines · J. Bruce Fields

I'd rather leave that introduction as it is--just as a section that advertises the git features without trying to explain much. And I'd rather not mention push until we have a chance to explain how to use it.

You talk like you'd have an eternity to explain Git. But that is not true. A developer, especially those whom Git is forced upon, have an attention span shorter than their pub1c hair.

I _know_ that _I_ did not read the whole document about "Branching and merging in Git".

Ciao,
Dscho

#13 lore raw
Quoted 11 lines · Johannes Schindelin

Hi,

Quoted 3 lines · J. Bruce Fields

I'd rather leave that introduction as it is--just as a section that advertises the git features without trying to explain much. And I'd rather not mention push until we have a chance to explain how to use it.

You talk like you'd have an eternity to explain Git. But that is not true. A developer, especially those whom Git is forced upon, have an attention span shorter than their pub1c hair.

Definitely, I agree. So that argues for locating the most import stuff as close to start of the document as possible. But obviously there's lot of important stuff and you can't do that with everything, so you also have to rely on keeping things organized so people can more easily skip to the middle.

The rest of the introduction is all git marketing: why you should like using git instead of cvs. So someone skimming for the quickest possible "how do I make changes?" stuff may skip it entirely.

The thing that might help such a skimmer the most, actually, would be a more helpful title for the section that actually does have what they're looking for. And making sure that particular section has the right stuff. How about something like this?

--b.

cvs-migration: improved section titles, better push/commit explanation

Rename the section titles to make the "how-to" content of the section obvious. Also clarify that changes have to be commited before they can be pushed.

---

 cvs-migration.txt |   19 ++++++++++++-------
 1 file changed, 12 insertions(+), 7 deletions(-)
Documentation/cvs-migration.txt +12 -7
index 6812683..726b48d 100644
@@ -76,8 +76,8 @@ variants of this model.
 With a small group, developers may just pull changes from each other's
 repositories without the need for a central maintainer.
 
-Emulating the CVS Development Model
------------------------------------
+Creating a Shared Repository
+----------------------------
 
 Start with an ordinary git working directory containing the project, and
 remove the checked-out files, keeping just the bare .git directory:
@@ -105,7 +105,10 @@ $ GIT_DIR=repo.git git repo-config core.
 Make sure committers have a umask of at most 027, so that the directories
 they create are writable and searchable by other group members.
 
-Suppose this repository is now set up in /pub/repo.git on the host
+Performing Development on a Shared Repository
+---------------------------------------------
+
+Suppose a repository is now set up in /pub/repo.git on the host
 foo.com.  Then as an individual committer you can clone the shared
 repository:
 
@@ -134,15 +137,17 @@ Pull: master:origin
 ------------
 ================================
 
-You can update the shared repository with your changes using:
+You can update the shared repository with your changes by first commiting
+your changes, and then using:
 
 ------------------------------------------------
 $ git push origin master
 ------------------------------------------------
 
-If someone else has updated the repository more recently, `git push`, like
-`cvs commit`, will complain, in which case you must pull any changes
-before attempting the push again.
+to "push" those commits to the shared repository.  If someone else has
+updated the repository more recently, `git push`, like `cvs commit`, will
+complain, in which case you must pull any changes before attempting the
+push again.
 
 In the `git push` command above we specify the name of the remote branch
#14 lore raw
Quoted 6 lines · J. Bruce Fields

On Wed, Dec 06, 2006 at 04:16:57PM +0100, Johannes Schindelin wrote:
Definitely, I agree. So that argues for locating the most import stuff as close to start of the document as possible. But obviously there's lot of important stuff and you can't do that with everything, so you also have to rely on keeping things organized so people can more easily skip to the middle.

Hm, but, come to think of it, I agree with you that the "how to commit and push" really should come earlier, since that's the stuff most people need to know; currently the order is roughly:

importing a cvs archive
creating a shared repository
committing to a shared repository

We should start out with the assumption that a shared repo is already set up and make it:

committing to a shared repository
creating a shared repository
importing a cvs archive

which puts it in stuff-most-people-need-to-know to stuff-less-people-need-to-know order. Maybe the current introduction should even be postponed to later.

And some day we should move that whole final CVS annotate section elsewhere.

#15 lore raw
Quoted 2 lines · J. Bruce Fields

And some day we should move that whole final CVS annotate section elsewhere.

I agree that we should make that particular document shorter by catering the immediate need of CVS migrant. No need for git marketting and showing off the power.

In that spirit, I think we can lose the section on 'annotate' altogether now. It was written in June 2005, way before 'annotate' and 'blame', both of which came in Feb 2006.

#16 lore raw

PATCH 1/1 Documentation: reorganize cvs-migration.txt

Modify cvs-migration.txt so it explains first how to develop against a shared repository, then how to set up a shared repository, then how to import a repository from cvs. Though this seems chronologically backwards, it's still readable in this order, and it puts the more commonly needed material closer to the front.

Remove the annotate/pickaxe section; perhaps it can find a place elsewhere in the future. Remove most of the "why git is better than cvs" stuff from the introduction.

Add some minor clarifications, including two that have come up several times on the mailing list:

1. Recommend committing any changes before running pull.
2. Note that changes must be commited before they can be pushed.

Update the clone discussion to reflect the new --use-separate-remotes default, and add a brief mention of git-cvsserver.

---
 Documentation/cvs-migration.txt |  349 ++++++++++++---------------------------
 1 files changed, 109 insertions(+), 240 deletions(-)
Documentation/cvs-migration.txt +109 -240
index 6812683..773fc99 100644
@@ -1,113 +1,21 @@
 git for CVS users
 =================
 
-So you're a CVS user. That's OK, it's a treatable condition.  The job of
-this document is to put you on the road to recovery, by helping you
-convert an existing cvs repository to git, and by showing you how to use a
-git repository in a cvs-like fashion.
+Git differs from CVS in that every working tree contains a repository with
+a full copy of the project history, and no repository is inherently more
+important than any other.  However, you can emulate the CVS model by
+designating a single shared repository which people can synchronize with;
+this document explains how to do that.
 
 Some basic familiarity with git is required.  This
 link:tutorial.html[tutorial introduction to git] should be sufficient.
 
-First, note some ways that git differs from CVS:
-
-  * Commits are atomic and project-wide, not per-file as in CVS.
-
-  * Offline work is supported: you can make multiple commits locally,
-    then submit them when you're ready.
-
-  * Branching is fast and easy.
-
-  * Every working tree contains a repository with a full copy of the
-    project history, and no repository is inherently more important than
-    any other.  However, you can emulate the CVS model by designating a
-    single shared repository which people can synchronize with; see below
-    for details.
-
-Importing a CVS archive
------------------------
-
-First, install version 2.1 or higher of cvsps from
-link:http://www.cobite.com/cvsps/[http://www.cobite.com/cvsps/] and make
-sure it is in your path.  The magic command line is then
-
--------------------------------------------
-$ git cvsimport -v -d <cvsroot> -C <destination> <module>
--------------------------------------------
-
-This puts a git archive of the named CVS module in the directory
-<destination>, which will be created if necessary.  The -v option makes
-the conversion script very chatty.
-
-The import checks out from CVS every revision of every file.  Reportedly
-cvsimport can average some twenty revisions per second, so for a
-medium-sized project this should not take more than a couple of minutes.
-Larger projects or remote repositories may take longer.
-
-The main trunk is stored in the git branch named `origin`, and additional
-CVS branches are stored in git branches with the same names.  The most
-recent version of the main trunk is also left checked out on the `master`
-branch, so you can start adding your own changes right away.
-
-The import is incremental, so if you call it again next month it will
-fetch any CVS updates that have been made in the meantime.  For this to
-work, you must not modify the imported branches; instead, create new
-branches for your own changes, and merge in the imported branches as
-necessary.
-
-Development Models
-------------------
-
-CVS users are accustomed to giving a group of developers commit access to
-a common repository.  In the next section we'll explain how to do this
-with git.  However, the distributed nature of git allows other development
-models, and you may want to first consider whether one of them might be a
-better fit for your project.
-
-For example, you can choose a single person to maintain the project's
-primary public repository.  Other developers then clone this repository
-and each work in their own clone.  When they have a series of changes that
-they're happy with, they ask the maintainer to pull from the branch
-containing the changes.  The maintainer reviews their changes and pulls
-them into the primary repository, which other developers pull from as
-necessary to stay coordinated.  The Linux kernel and other projects use
-variants of this model.
-
-With a small group, developers may just pull changes from each other's
-repositories without the need for a central maintainer.
-
-Emulating the CVS Development Model
+Developing against a CVS repository
 -----------------------------------
 
-Start with an ordinary git working directory containing the project, and
-remove the checked-out files, keeping just the bare .git directory:
-
-------------------------------------------------
-$ mv project/.git /pub/repo.git
-$ rm -r project/
-------------------------------------------------
-
-Next, give every team member read/write access to this repository.  One
-easy way to do this is to give all the team members ssh access to the
-machine where the repository is hosted.  If you don't want to give them a
-full shell on the machine, there is a restricted shell which only allows
-users to do git pushes and pulls; see gitlink:git-shell[1].
-
-Put all the committers in the same group, and make the repository
-writable by that group:
-
-------------------------------------------------
-$ chgrp -R $group repo.git
-$ find repo.git -mindepth 1 -type d |xargs chmod ug+rwx,g+s
-$ GIT_DIR=repo.git git repo-config core.sharedrepository true
-------------------------------------------------
-
-Make sure committers have a umask of at most 027, so that the directories
-they create are writable and searchable by other group members.
-
-Suppose this repository is now set up in /pub/repo.git on the host
+Suppose a shared repository is set up in /pub/repo.git on the host
 foo.com.  Then as an individual committer you can clone the shared
-repository:
+repository over ssh with:
 
 ------------------------------------------------
 $ git clone foo.com:/pub/repo.git/ my-project
@@ -121,7 +29,8 @@ $ git pull origin
 ------------------------------------------------
 
 which merges in any work that others might have done since the clone
-operation.
+operation.  If there are uncommitted changes in your working tree, commit
+them first before running git pull.
 
 [NOTE]
 ================================
@@ -129,20 +38,22 @@ The first `git clone` places the following in the
 `my-project/.git/remotes/origin` file, and that's why the previous step
 and the next step both work.
 ------------
-URL: foo.com:/pub/project.git/ my-project
-Pull: master:origin
+URL: foo.com:/pub/project.git/
+Pull: refs/heads/master:refs/remotes/origin/master
 ------------
 ================================
 
-You can update the shared repository with your changes using:
+You can update the shared repository with your changes by first commiting
+your changes, and then using:
 
 ------------------------------------------------
 $ git push origin master
 ------------------------------------------------
 
-If someone else has updated the repository more recently, `git push`, like
-`cvs commit`, will complain, in which case you must pull any changes
-before attempting the push again.
+to "push" those commits to the shared repository.  If someone else has
+updated the repository more recently, `git push`, like `cvs commit`, will
+complain, in which case you must pull any changes before attempting the
+push again.
 
 In the `git push` command above we specify the name of the remote branch
 to update (`master`).  If we leave that out, `git push` tries to update
@@ -151,21 +62,76 @@ in the local repository.  So the last `push` can be done with either of:
 
 ------------
 $ git push origin
-$ git push repo.shared.xz:/pub/scm/project.git/
+$ git push foo.com:/pub/project.git/
 ------------
 
 as long as the shared repository does not have any branches
 other than `master`.
 
-[NOTE]
-============
-Because of this behavior, if the shared repository and the developer's
-repository both have branches named `origin`, then a push like the above
-attempts to update the `origin` branch in the shared repository from the
-developer's `origin` branch.  The results may be unexpected, so it's
-usually best to remove any branch named `origin` from the shared
-repository.
-============
+Setting Up a Shared Repository
+------------------------------
+
+We assume you have already created a git repository for your project,
+possibly created from scratch or from a tarball (see the
+link:tutorial.html[tutorial]), or imported from an already existing CVS
+repository (see the next section).
+
+If your project's working directory is /home/alice/myproject, you can
+create a shared repository at /pub/repo.git with:
+
+------------------------------------------------
+$ git clone -bare /home/alice/myproject /pub/repo.git
+------------------------------------------------
+
+Next, give every team member read/write access to this repository.  One
+easy way to do this is to give all the team members ssh access to the
+machine where the repository is hosted.  If you don't want to give them a
+full shell on the machine, there is a restricted shell which only allows
+users to do git pushes and pulls; see gitlink:git-shell[1].
+
+Put all the committers in the same group, and make the repository
+writable by that group:
+
+------------------------------------------------
+$ cd /pub
+$ chgrp -R $group repo.git
+$ find repo.git -mindepth 1 -type d |xargs chmod ug+rwx,g+s
+$ GIT_DIR=repo.git git repo-config core.sharedrepository true
+------------------------------------------------
+
+Make sure committers have a umask of at most 027, so that the directories
+they create are writable and searchable by other group members.
+
+Importing a CVS archive
+-----------------------
+
+First, install version 2.1 or higher of cvsps from
+link:http://www.cobite.com/cvsps/[http://www.cobite.com/cvsps/] and make
+sure it is in your path.  The magic command line is then
+
+-------------------------------------------
+$ git cvsimport -v -d <cvsroot> -C <destination> <module>
+-------------------------------------------
+
+This puts a git archive of the named CVS module in the directory
+<destination>, which will be created if necessary.  The -v option makes
+the conversion script very chatty.
+
+The import checks out from CVS every revision of every file.  Reportedly
+cvsimport can average some twenty revisions per second, so for a
+medium-sized project this should not take more than a couple of minutes.
+Larger projects or remote repositories may take longer.
+
+The main trunk is stored in the git branch named `origin`, and additional
+CVS branches are stored in git branches with the same names.  The most
+recent version of the main trunk is also left checked out on the `master`
+branch, so you can start adding your own changes right away.
+
+The import is incremental, so if you call it again next month it will
+fetch any CVS updates that have been made in the meantime.  For this to
+work, you must not modify the imported branches; instead, create new
+branches for your own changes, and merge in the imported branches as
+necessary.
 
 Advanced Shared Repository Management
 -------------------------------------
@@ -178,127 +144,30 @@ You can enforce finer grained permissions using update hooks.  See
 link:howto/update-hook-example.txt[Controlling access to branches using
 update hooks].
 
-CVS annotate
-------------
+Providing CVS Access to a git Repository
+----------------------------------------
+
+It is also possible to provide true CVS access to a git repository, so
+that developers can still use CVS; see gitlink:git-cvsserver[1] for
+details.
+
+Alternative Development Models
+------------------------------
+
+CVS users are accustomed to giving a group of developers commit access to
+a common repository.  As we've seen, this is also possible with git.
+However, the distributed nature of git allows other development models,
+and you may want to first consider whether one of them might be a better
+fit for your project.
+
+For example, you can choose a single person to maintain the project's
+primary public repository.  Other developers then clone this repository
+and each work in their own clone.  When they have a series of changes that
+they're happy with, they ask the maintainer to pull from the branch
+containing the changes.  The maintainer reviews their changes and pulls
+them into the primary repository, which other developers pull from as
+necessary to stay coordinated.  The Linux kernel and other projects use
+variants of this model.
 
-So, something has gone wrong, and you don't know whom to blame, and
-you're an ex-CVS user and used to do "cvs annotate" to see who caused
-the breakage. You're looking for the "git annotate", and it's just
-claiming not to find such a script. You're annoyed.
-
-Yes, that's right.  Core git doesn't do "annotate", although it's
-technically possible, and there are at least two specialized scripts out
-there that can be used to get equivalent information (see the git
-mailing list archives for details). 
-
-git has a couple of alternatives, though, that you may find sufficient
-or even superior depending on your use.  One is called "git-whatchanged"
-(for obvious reasons) and the other one is called "pickaxe" ("a tool for
-the software archaeologist"). 
-
-The "git-whatchanged" script is a truly trivial script that can give you
-a good overview of what has changed in a file or a directory (or an
-arbitrary list of files or directories).  The "pickaxe" support is an
-additional layer that can be used to further specify exactly what you're
-looking for, if you already know the specific area that changed.
-
-Let's step back a bit and think about the reason why you would
-want to do "cvs annotate a-file.c" to begin with.
-
-You would use "cvs annotate" on a file when you have trouble
-with a function (or even a single "if" statement in a function)
-that happens to be defined in the file, which does not do what
-you want it to do.  And you would want to find out why it was
-written that way, because you are about to modify it to suit
-your needs, and at the same time you do not want to break its
-current callers.  For that, you are trying to find out why the
-original author did things that way in the original context.
-
-Many times, it may be enough to see the commit log messages of
-commits that touch the file in question, possibly along with the
-patches themselves, like this:
-
-	$ git-whatchanged -p a-file.c
-
-This will show log messages and patches for each commit that
-touches a-file.
-
-This, however, may not be very useful when this file has many
-modifications that are not related to the piece of code you are
-interested in.  You would see many log messages and patches that
-do not have anything to do with the piece of code you are
-interested in.  As an example, assuming that you have this piece
-of code that you are interested in in the HEAD version:
-
-	if (frotz) {
-		nitfol();
-	}
-
-you would use git-rev-list and git-diff-tree like this:
-
-	$ git-rev-list HEAD |
-	  git-diff-tree --stdin -v -p -S'if (frotz) {
-		nitfol();
-	}'
-
-We have already talked about the "\--stdin" form of git-diff-tree
-command that reads the list of commits and compares each commit
-with its parents (otherwise you should go back and read the tutorial).
-The git-whatchanged command internally runs
-the equivalent of the above command, and can be used like this:
-
-	$ git-whatchanged -p -S'if (frotz) {
-		nitfol();
-	}'
-
-When the -S option is used, git-diff-tree command outputs
-differences between two commits only if one tree has the
-specified string in a file and the corresponding file in the
-other tree does not.  The above example looks for a commit that
-has the "if" statement in it in a file, but its parent commit
-does not have it in the same shape in the corresponding file (or
-the other way around, where the parent has it and the commit
-does not), and the differences between them are shown, along
-with the commit message (thanks to the -v flag).  It does not
-show anything for commits that do not touch this "if" statement.
-
-Also, in the original context, the same statement might have
-appeared at first in a different file and later the file was
-renamed to "a-file.c".  CVS annotate would not help you to go
-back across such a rename, but git would still help you in such
-a situation.  For that, you can give the -C flag to
-git-diff-tree, like this:
-
-	$ git-whatchanged -p -C -S'if (frotz) {
-		nitfol();
-	}'
-
-When the -C flag is used, file renames and copies are followed.
-So if the "if" statement in question happens to be in "a-file.c"
-in the current HEAD commit, even if the file was originally
-called "o-file.c" and then renamed in an earlier commit, or if
-the file was created by copying an existing "o-file.c" in an
-earlier commit, you will not lose track.  If the "if" statement
-did not change across such a rename or copy, then the commit that
-does rename or copy would not show in the output, and if the
-"if" statement was modified while the file was still called
-"o-file.c", it would find the commit that changed the statement
-when it was in "o-file.c".
-
-NOTE: The current version of "git-diff-tree -C" is not eager
-  enough to find copies, and it will miss the fact that a-file.c
-  was created by copying o-file.c unless o-file.c was somehow
-  changed in the same commit.
-
-You can use the --pickaxe-all flag in addition to the -S flag.
-This causes the differences from all the files contained in
-those two commits, not just the differences between the files
-that contain this changed "if" statement:
-
-	$ git-whatchanged -p -C -S'if (frotz) {
-		nitfol();
-	}' --pickaxe-all
-
-NOTE: This option is called "--pickaxe-all" because -S
-  option is internally called "pickaxe", a tool for software
-  archaeologists.
+With a small group, developers may just pull changes from each other's
+repositories without the need for a central maintainer.
Signature · 1 line
1.4.4.1.GIT
#17 lore raw

Re: [PATCH] Documentation: reorganize cvs-migration.txt

Documentation/cvs-migration.txt

Quoted 5 lines · J. Bruce Fields
Documentation/cvs-migration.txt +0 -0
index 6812683..773fc99 100644
@@ -1,113 +1,21 @@

This conflicted in a funny way with your own commit but I think this version (773fc99 blob) supersedes its contents.

I munged only one line, though. The title of this section should not be "a CVS repository" but "a shared repository" for obvious reasons ;-).

Quoted 9 lines
Documentation/cvs-migration.txt +3 -0
+Developing against a CVS repository
 -----------------------------------
 
+Suppose a shared repository is set up in /pub/repo.git on the host
 foo.com.  Then as an individual committer you can clone the shared
+repository over ssh with:
 
 ------------------------------------------------
 $ git clone foo.com:/pub/repo.git/ my-project
#18 lore raw

Re: [PATCH] Documentation: reorganize cvs-migration.txt

Quoted 10 lines · Junio C Hamano

Documentation/cvs-migration.txt

Quoted 5 lines · J. Bruce Fields
Documentation/cvs-migration.txt +0 -0
index 6812683..773fc99 100644
@@ -1,113 +1,21 @@

This conflicted in a funny way with your own commit but I think this version (773fc99 blob) supersedes its contents.

Oh, yeah, sorry, I should have made an incremental patch.

Quoted 3 lines

I munged only one line, though. The title of this section should not be "a CVS repository" but "a shared repository" for obvious reasons ;-).

Oops, yes, thanks!

#19 lore raw

Re: [PATCH] Documentation: reorganize cvs-migration.txt

In reply to J. Bruce Fields

Hi,

Quoted 5 lines · J. Bruce Fields

Modify cvs-migration.txt so it explains first how to develop against a shared repository, then how to set up a shared repository, then how to import a repository from cvs. Though this seems chronologically backwards, it's still readable in this order, and it puts the more commonly needed material closer to the front.

This is a laudable goal, and the order makes sense (put first that what most people are interested in).

A few comments:

- just skimming the patch, I found "commiting" (needs another "t"), and "-bare" (needs another "-").

- It might make more sense to "git init-db --shared" and fetch the initial revision into it, rather than clone it and then fix. You might also want to mention that the "--shared" of -clone is different in meaning from that of -init-db (make just a footnote of it, to avoid intimidating readers).

- By far the easiest method to import from cvs is to go to a checked out _CVS_ working directory, and just say "git cvsimport".

Ciao,
Dscho

#20 lore raw

Re: [PATCH] Documentation: reorganize cvs-migration.txt

Quoted 4 lines · Johannes Schindelin

This is a laudable goal, and the order makes sense (put first that what most people are interested in).

A few comments:

Thanks for the comments! Patch, incremental against the previous one, appended.

Quoted 2 lines

- just skimming the patch, I found "commiting" (needs another "t"), and "-bare" (needs another "-").

Got it, thanks.

Quoted 2 lines

- It might make more sense to "git init-db --shared" and fetch the initial revision into it, rather than clone it and then fix.

I do like the idea of anything that gets rid of the ugly find|xargs chmod. Result included below (untested). Is that what you were thinking of?

Quoted 4 lines

You might also want
to mention that the "--shared" of -clone is different in meaning from that of -init-db (make just a footnote of it, to avoid intimidating readers).

I'm ignoring this for now. We can add it later if someone says they've run into it. (But honestly it's partly just laziness on my part--no objection if you want to make the patch.)

It's too bad about that option-name conflict. It'd be nice just to be able to do the whole thing with one clone commandline. And it'd also make sense to allow clone and init-db to share commandline options where it made sense.

Quoted 2 lines

- By far the easiest method to import from cvs is to go to a checked out _CVS_ working directory, and just say "git cvsimport".

Neat, I didn't know about that. Done. I left the "-C" in there on the assumption they often won't want to drop the result into the CVS working directory.

Also did some miscellaneous cleanup.

--b.

commit 48ec79a74d0daa134b677ed5458beb873aa06e9a

Author: J. Bruce Fields <[email protected]>
Date:   Thu Dec 7 12:38:09 2006 -0500

Documentation: simpler shared repo creation, miscellaneous cleanup

Create the shared repo with init-db --shared, fetch, and manual extraction of .git directory, instead of using clone --bare.

Suggest running git-cvsimport from cvs working directory, more convenient thatn providing all the CVS information on the commandline.

Fix a couple mispellings, add a couple manpage links.

Thanks to Johannes Schindelin.

Documentation/cvs-migration.txt +21 -9
index 773fc99..4fab0d7 100644
@@ -43,8 +43,8 @@ Pull: refs/heads/master:refs/remotes/origin/master
 ------------
 ================================
 
-You can update the shared repository with your changes by first commiting
-your changes, and then using:
+You can update the shared repository with your changes by first committing
+your changes, and then using the gitlink:git-push[1] command:
 
 ------------------------------------------------
 $ git push origin master
@@ -76,11 +76,23 @@ possibly created from scratch or from a tarball (see the
 link:tutorial.html[tutorial]), or imported from an already existing CVS
 repository (see the next section).
 
-If your project's working directory is /home/alice/myproject, you can
-create a shared repository at /pub/repo.git with:
+Assume your existing repo is at /home/alice/myproject.  Create a temporary
+empty shared repository and fetch your project into it:
 
 ------------------------------------------------
-$ git clone -bare /home/alice/myproject /pub/repo.git
+$ mkdir /pub/temporary
+$ cd /pub/temporary
+$ git init-db --shared
+$ git fetch /home/alice/myproject master:master
+------------------------------------------------
+
+Then create a "bare" repository at /pub/repo.git by just moving the contents of
+the .git directory there.  The temporary repository can then be discarded.
+
+------------------------------------------------
+$ mv .git /pub/repo.git
+$ cd ..
+$ rm -rf temporary
 ------------------------------------------------
 
 Next, give every team member read/write access to this repository.  One
@@ -107,15 +119,15 @@ Importing a CVS archive
 
 First, install version 2.1 or higher of cvsps from
 link:http://www.cobite.com/cvsps/[http://www.cobite.com/cvsps/] and make
-sure it is in your path.  The magic command line is then
+sure it is in your path.  Then cd to a checked out CVS working directory
+of the project you are interested in and run gitlink:git-cvsimport[1]:
 
 -------------------------------------------
-$ git cvsimport -v -d <cvsroot> -C <destination> <module>
+$ git cvsimport -C <destination>
 -------------------------------------------
 
 This puts a git archive of the named CVS module in the directory
-<destination>, which will be created if necessary.  The -v option makes
-the conversion script very chatty.
+<destination>, which will be created if necessary.
 
 The import checks out from CVS every revision of every file.  Reportedly
#21 lore raw

Re: [PATCH] Documentation: reorganize cvs-migration.txt

Hi,

Quoted 4 lines · J. Bruce Fields

+$ mkdir /pub/temporary
+$ cd /pub/temporary
+$ git init-db --shared
+$ git fetch /home/alice/myproject master:master

Even easier:

$ mkdir /pub/my-repo.git
$ cd /pub/my-repo.git
$ git --bare init-db --shared
$ git --bare fetch /home/alice/myproject master:master

(Totally untested, of course.)

Ciao,
Dscho

#22 lore raw

Re: [PATCH] Documentation: reorganize cvs-migration.txt

Quoted 8 lines · Johannes Schindelin

Even easier:

$ mkdir /pub/my-repo.git
$ cd /pub/my-repo.git
$ git --bare init-db --shared
$ git --bare fetch /home/alice/myproject master:master

(Totally untested, of course.)

Of course--for some reason I didn't think of doing init-db with --bare. Thanks again.

--b.

From 22e5bdd9de398f29dfb11125a0921bb4529e2ab7 Mon Sep 17 00:00:00 2001
From: J. Bruce Fields <[email protected]>
Date: Thu, 7 Dec 2006 22:32:28 -0500
Subject: [PATCH] Documentation: simpler shared repository creation

Take Johannes Schindelin's suggestion for a further simplification of the shared repository creation using git --bare init-db --shared.

Also fix a mistake from the previous patch: I forgot to remove the manual setup which the --shared does for us.

---
 Documentation/cvs-migration.txt |   27 ++++++++-------------------
 1 files changed, 8 insertions(+), 19 deletions(-)
Documentation/cvs-migration.txt +8 -19
index 4fab0d7..20c5719 100644
@@ -76,23 +76,15 @@ possibly created from scratch or from a tarball (see the
 link:tutorial.html[tutorial]), or imported from an already existing CVS
 repository (see the next section).
 
-Assume your existing repo is at /home/alice/myproject.  Create a temporary
-empty shared repository and fetch your project into it:
+Assume your existing repo is at /home/alice/myproject.  Create a new "bare"
+repository (a repository without a working tree) and fetch your project into
+it:
 
 ------------------------------------------------
-$ mkdir /pub/temporary
-$ cd /pub/temporary
-$ git init-db --shared
-$ git fetch /home/alice/myproject master:master
-------------------------------------------------
-
-Then create a "bare" repository at /pub/repo.git by just moving the contents of
-the .git directory there.  The temporary repository can then be discarded.
-
-------------------------------------------------
-$ mv .git /pub/repo.git
-$ cd ..
-$ rm -rf temporary
+$ mkdir /pub/my-repo.git
+$ cd /pub/my-repo.git
+$ git --bare init-db --shared
+$ git --bare fetch /home/alice/myproject master:master
 ------------------------------------------------
 
 Next, give every team member read/write access to this repository.  One
@@ -105,10 +97,7 @@ Put all the committers in the same group, and make the repository
 writable by that group:
 
 ------------------------------------------------
-$ cd /pub
-$ chgrp -R $group repo.git
-$ find repo.git -mindepth 1 -type d |xargs chmod ug+rwx,g+s
-$ GIT_DIR=repo.git git repo-config core.sharedrepository true
+$ chgrp -R $group /pub/my-repo.git
 ------------------------------------------------
 
 Make sure committers have a umask of at most 027, so that the directories
Signature · 1 line
1.4.4.1.GIT
#23 lore raw

Re: [PATCH] Documentation: reorganize cvs-migration.txt

Documentation/cvs-migration.txt

Quoted 18 lines · J. Bruce Fields

From 22e5bdd9de398f29dfb11125a0921bb4529e2ab7 Mon Sep 17 00:00:00 2001
From: J. Bruce Fields <[email protected]>
Date: Thu, 7 Dec 2006 22:32:28 -0500
Subject: [PATCH] Documentation: simpler shared repository creation

Take Johannes Schindelin's suggestion for a further simplification of the shared repository creation using git --bare init-db --shared.

Also fix a mistake from the previous patch: I forgot to remove the manual setup which the --shared does for us.

---
 Documentation/cvs-migration.txt |   27 ++++++++-------------------
 1 files changed, 8 insertions(+), 19 deletions(-)
Documentation/cvs-migration.txt +0 -0
index 4fab0d7..20c5719 100644

Well, this does not apply at all, as I do not have a commit with 4fab0d7 blob and already applied the reordering patch from you. Could you fix up and send again after I push out the latest? I could try to coax into the documentation, but since I am not even a CVS migrant myself and am known to be very bad at documentation, I _really_ don't think you want me to do so.

;-)

#24 lore raw

Re: [PATCH] Documentation: reorganize cvs-migration.txt

Quoted 2 lines · Junio C Hamano

Well, this does not apply at all, as I do not have a commit with 4fab0d7 blob and already applied the reordering patch from you.

OK, sorry for the confusion.

Quoted 1 line

Could you fix up and send again after I push out the latest?

Definitely. Is this better?

--b.

Documentation: simpler shared repository creation

Take Johannes Schindelin's suggestions for a further simplification of the shared repository creation using git --bare init-db --shared, and for a simplified cvsimport using an existing CVS working directory.

Also insert more man page references.

 cvs-migration.txt |   27 ++++++++++++++-------------
 1 file changed, 14 insertions(+), 13 deletions(-)

---

Documentation/cvs-migration.txt +14 -13
index 47846bd..b657f45 100644
@@ -43,8 +43,8 @@ Pull: refs/heads/master:refs/remotes/origin/master
 ------------
 ================================
 
-You can update the shared repository with your changes by first commiting
-your changes, and then using:
+You can update the shared repository with your changes by first committing
+your changes, and then using the gitlink:git-push[1] command:
 
 ------------------------------------------------
 $ git push origin master
@@ -76,11 +76,15 @@ possibly created from scratch or from a tarball (see the
 link:tutorial.html[tutorial]), or imported from an already existing CVS
 repository (see the next section).
 
-If your project's working directory is /home/alice/myproject, you can
-create a shared repository at /pub/repo.git with:
+Assume your existing repo is at /home/alice/myproject.  Create a new "bare"
+repository (a repository without a working tree) and fetch your project into
+it:
 
 ------------------------------------------------
-$ git clone -bare /home/alice/myproject /pub/repo.git
+$ mkdir /pub/my-repo.git
+$ cd /pub/my-repo.git
+$ git --bare init-db --shared
+$ git --bare fetch /home/alice/myproject master:master
 ------------------------------------------------
 
 Next, give every team member read/write access to this repository.  One
@@ -93,10 +97,7 @@ Put all the committers in the same group, and make the repository
 writable by that group:
 
 ------------------------------------------------
-$ cd /pub
-$ chgrp -R $group repo.git
-$ find repo.git -mindepth 1 -type d |xargs chmod ug+rwx,g+s
-$ GIT_DIR=repo.git git repo-config core.sharedrepository true
+$ chgrp -R $group /pub/my-repo.git
 ------------------------------------------------
 
 Make sure committers have a umask of at most 027, so that the directories
@@ -107,15 +108,15 @@ Importing a CVS archive
 
 First, install version 2.1 or higher of cvsps from
 link:http://www.cobite.com/cvsps/[http://www.cobite.com/cvsps/] and make
-sure it is in your path.  The magic command line is then
+sure it is in your path.  Then cd to a checked out CVS working directory
+of the project you are interested in and run gitlink:git-cvsimport[1]:
 
 -------------------------------------------
-$ git cvsimport -v -d <cvsroot> -C <destination> <module>
+$ git cvsimport -C <destination>
 -------------------------------------------
 
 This puts a git archive of the named CVS module in the directory
-<destination>, which will be created if necessary.  The -v option makes
-the conversion script very chatty.
+<destination>, which will be created if necessary.
 
 The import checks out from CVS every revision of every file.  Reportedly
#25 lore raw
In reply to J. Bruce Fields
Quoted 10 lines · J. Bruce Fields

We should start out with the assumption that a shared repo is already set up and make it:

committing to a shared repository
creating a shared repository
importing a cvs archive

which puts it in stuff-most-people-need-to-know to stuff-less-people-need-to-know order. Maybe the current introduction should even be postponed to later.

Yes, definitely!

I'm not complaining about changing to git, but Dscho's comment really rings true:

Quoted 2 lines

A developer, especially those whom Git is forced upon, have an attention span shorter than their pub1c hair.

I'm in the middle of exam period, I have a term papers to write, and I have two weeks of lilypond bug reports and doc typos to process. I don't care if git can do branches really nicely or walk my dog or cure cancer. I can look at that stuff later -- right now I just want to fix things and upload them.

Cheers,

#26 lore raw
Quoted 5 lines · Graham Percival

I'm in the middle of exam period, I have a term papers to write, and I have two weeks of lilypond bug reports and doc typos to process. I don't care if git can do branches really nicely or walk my dog or cure cancer. I can look at that stuff later -- right now I just want to fix things and upload them.

Yeah. It's a tricky problem; different people need different things, and to cover everything (and explain it correctly) the documentation needs to be long; but to ensure that impatient people can get to what they need quickly, there needs to be a short, clear path to their particular need.

A few down-to-earth approaches that could help:

- Clearer section/chapter titles, so we can generate tables of contents where people can quickly find stuff--so, titles that explain what the section will show you how to do with minimized use of jargon that the user doesn't know yet ("how to keep a repository up-to-date" as opposed to "git-fetch and remotes").

- As in "Everyday Git", think about what different groups of users need. But where possible, try to order documentation with the stuff needed by the largest group of people first. (For example, right now all the tutorials start with "git init-db" and "git commit", assuming people are starting a project from scratch, when the more typical usage is probably someone joining an existing project, and possibly doing only read-only stuff at first.)

- Clearer ordering and dependencies, so when people find the "how to resolve merges" section, they can quickly see what else they'd need to read before that. (And, yeah, I realize 99% of the time they won't actually do that--they'll just dive right in and try a few examples. But at least they'll know where to turn if that gets them in trouble....)

#27 lore raw
In reply to J. Bruce Fields

J. Bruce Fields escreveu:

Quoted 8 lines · Han-Wen Nienhuys
Quoted 6 lines

Johannes Schindelin escreveu:

Quoted 3 lines

It really is an important concept to grasp for people coming from CVS. Even if it is briefly mentioned, it is not obvious enough to sink in.

I think the goal is laudable, but IMO it would be better to shorten the document rather adding more text.

Quoted 6 lines

OK, but...

Quoted 2 lines
 Documentation/cvs-migration.txt |   34 +++++++++++++++++++++++-----------
 1 files changed, 23 insertions(+), 11 deletions(-)

... that lengthens it even more than the proposed addition.

Yes, but with white space.

Quoted 3 lines

I'd rather leave that introduction as it is--just as a section that advertises the git features without trying to explain much. And I'd rather not mention push until we have a chance to explain how to use it.

As was mentioned in another thread, it make more sense to split this file up into separate documents for project contributors and project admins.

A message that is not in the archive (sent off-list or not yet received): Pine.LNX.4.63.0612060053400.28348@wbgn013.biozentrum.uni-wuerzburg.de

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): Pine.LNX.4.63.0612060157020.28348@wbgn013.biozentrum.uni-wuerzburg.de

#31 lore raw

Re: git patch

Johannes Schindelin escreveu:

Quoted 7 lines

The nice thing for me about Git: you never lose anything. Unless you say "git prune" (in which case you really should know what you are doing), you do not lose (committed) data.

Now, I promised to tell you what to do if all the files seem modified. Did you look through "git -p diff"? (BTW with recent Git you only need "git diff" and it will pipe the result into your pager automatically.)

This actually bothers me as well from a UI point of view. Git-diff is used both for generating diffs between versions that come from git and the working tree/index.

I think it would be more logical to show those diffs as part of git-status and perhaps git-commit, eg.

  git-commit --dry-run <commitoptions>

shows the diff of what would be committed

  git-status --diff

shows diffs of modified files in the working tree.

This makes it more clear what each diff means.

Signature · 1 line
 Han-Wen Nienhuys - [email protected] - http://www.xs4all.nl/~hanwen
#32 lore raw

Re: git patch

Quoted 5 lines · Han-Wen Nienhuys

I think it would be more logical to show those diffs as part of git-status and perhaps git-commit, eg.

  git-commit --dry-run <commitoptions>

Quoted 7 lines

shows the diff of what would be committed

  git-status --diff

shows diffs of modified files in the working tree.

This makes it more clear what each diff means.

I'd rather say

  git-commit --diff

or

  git-diff --commit
Signature · 3 lines
Jakub Narebski
Warsaw, Poland
ShadeHawk on #git

A message that is not in the archive (sent off-list or not yet received): Pine.LNX.4.63.0612061105220.28348@wbgn013.biozentrum.uni-wuerzburg.de

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): Pine.LNX.4.63.0612061147540.28348@wbgn013.biozentrum.uni-wuerzburg.de

#36 lore raw

Re: git patch

Johannes Schindelin escreveu:

Quoted 9 lines
Quoted 1 line

shows the diff of the change that he just introduced

Okay. But you mean

$ git commit --dry file1 file2...

or

$ git commit --dry -a

Well, --dry would be usable both with -a and file1, file2.

I agree with Jakub that --diff might be a better name, but it should be part of git-commit command, rather than the git-diff.

Quoted 3 lines

Or, you use the script git-hunk-commit.bash which I posted. Which reminds
me: I wanted to rewrite it for you so it is more non-brand-new-bash friendly.

:)

that's really nice, but actually recording separate hunks is a bit of a headache if you have to do it over the command line. Under darcs, I always use darcsum in emacs. In git, I always use git-status.

Signature · 1 line
 Han-Wen Nienhuys - [email protected] - http://www.xs4all.nl/~hanwen
#37 lore raw

Re: git patch

In reply to Han-Wen Nienhuys
Quoted 5 lines · Han-Wen Nienhuys

I think it would be more logical to show those diffs as part of git-status and perhaps git-commit, eg.

  git-commit --dry-run <commitoptions>
Quoted 7 lines

shows the diff of what would be committed

  git-status --diff

shows diffs of modified files in the working tree.

This makes it more clear what each diff means.

Just in case people did not know, "git status" is pronounced as "git commit --dry-run".

It takes exactly the same set of parameters as "git commit", and shows what would have been in the commit log message editor as the status comments.

And it even takes the "-v" option that "git commit" takes.

#38 lore raw

git newbie problems

In reply to a message not in the archive

Greetings,

I'm posting these problems at Han-Wen and Dscho's insistence. I'm the documentation editor for GNU/LilyPond, so I'm reluctant to criticize other project's documentation unless I spend an hour or more seriously reading it. I'm quite willing to admit that I never seriously tried to read the docs on the overall theory of git (branches, repo, etc); I just flailed around looking for magic commands to make things work. By "make things work", I mean imitating my work style with cvs:

cvs co blah blah (which I simply copy and paste from savannah) while (true) {

  cvs update          // get changes that happened overnight
  vi foo/bar/baz.txt  // or whatever editing commands you do
  make; make web      // or whatever testing commands you do
  cvs update          // get latest changes to prepare for
                      // uploading my changes.

cvs ci foo/bar/baz.txt // upload changes
}

Once or twice a year I'll do "cvs diff" or "cvs add", but all I really want are the above commands. I figured that this should be really easy to do, so I kept on skimming through the docs, trying to find the equivalent of these really easy commands. (note that I was reading the "tutorial introduction to git")

I should add that I've received help on the lilypond-devel list; I'm posting this in case it helps future development for git docs, not because I need more help to use git.

This case was particularly difficult because the very first time I tried to commit... err... push... err... "make my doc changes available to everybody else" (whatever the right term is), there was this merge problem.

MERGE PROBLEM

Two people (me and another person) edited the same line on
Documentation/user/advanced.itely at the same time. (note that this file has existed for over a year; it's not a new file) When I tried to get the most recent changes, I'm greeted with this:
...
Trying really trivial in-index merge...
Documentation/user/advanced-notation.itely: needs merge
fatal: you need to resolve your current index first
Nope.
Merging HEAD with c21d3f3e1c77722e50d994763442e6f994b03ac2
Merging:
038b7fc Misc small updates (trying to make git work).
c21d3f3 Merge branch 'master' of
ssh+git://[email protected]/srv/git/lilypond
found 1 common ancestor(s):
84219bb don't have input/templates/ any longer.
fatal: Entry '.gitignore' would be overwritten by merge. Cannot merge.
No merge strategy handled the merge.

As a git newbie, I'm quite confused. OK, there's no merge strategy... so what do I do now? With cvs, the changes would be dumped into the file. I look at the file, found the conflict, and tried it again. I got the same error message, and then it occurred to me that although I changed the files in my ~/usr/src/lilypond, git might be storing these files somewhere else. So I tried

$ git commit Documentation/user/advanced-notation.itely
Cannot do a partial commit during a merge.
You might have meant to say 'git commit -i paths...', perhaps?

... eh? I'm trying to fix this so that you _can_ merge! Regardless, when I tried to update again, I get

$ git pull gnu master
...
Trying really trivial in-index merge...
fatal: Entry '.gitignore' would be overwritten by merge. Cannot merge.
Nope.
Merging HEAD with c21d3f3e1c77722e50d994763442e6f994b03ac2
Merging:
038b7fc Misc small updates (trying to make git work).
c21d3f3 Merge branch 'master' of
ssh+git://[email protected]/srv/git/lilypond
found 1 common ancestor(s):
84219bb don't have input/templates/ any longer.
fatal: Entry '.gitignore' would be overwritten by merge. Cannot merge.
No merge strategy handled the merge.

Now I'm totally confused, because I definitely haven't touched .gitignore.

SUGGESTIONS

The "tutorial introduction to git" looks like a nice document, but it assumes that you are in control of the project. For users who aren't in control (ie me) this is a problem, because it starts me skimming. "Importing a project"... nah, that's not me. "Merging branches"... I don't care; I'm going to shove everything into the main branch. "Using git for collaboration"... hmm, maybe this is the stuff I need to read. But by this point, I've already skimmed through five screens of info, so I'm not reading very carefully.

It would be nice to have an accompanying "tutorial introduction to contributing with git" for users (like me) who are not in control of a project.

Finally, it would be really nice if there was some mention of "resolving merge problems" in the tutorial (both in the current one and any new docs).

Cheers,
- Graham Percival

#39 lore raw

Re: git newbie problems

Quoted 3 lines · Graham Percival

Trying really trivial in-index merge... Documentation/user/advanced-notation.itely: needs merge
fatal: you need to resolve your current index first

You got from a "git pull", which means you were already in another merge (perhaps failed). That is a no-no.

The error messages need to be cleaned up and be more helpful. There is no question about it.

Quoted 10 lines

Nope.
Merging HEAD with c21d3f3e1c77722e50d994763442e6f994b03ac2 Merging:
038b7fc Misc small updates (trying to make git work). c21d3f3 Merge branch 'master' of ssh+git://[email protected]/srv/git/lilypond
found 1 common ancestor(s):
84219bb don't have input/templates/ any longer.
fatal: Entry '.gitignore' would be overwritten by merge. Cannot merge. No merge strategy handled the merge.

So the question is what you did _before_ initiating this "git pull".

For new people, we recommend to:

* make sure you were on a right branch (I think you are. You are on your 'master' branch and may not even have any other branches, which is fine.)

* make sure all your changes are committed.

before initiating a "git pull". And after a conflicted "git pull", if you choose to punt,

	$ git reset --hard

would take you back to the state before you started the pull.

Quoted 10 lines

SUGGESTIONS

The "tutorial introduction to git" looks like a nice document, but it assumes that you are in control of the project. For users who aren't in control (ie me) this is a problem, because it starts me skimming. "Importing a project"... nah, that's not me. "Merging branches"... I don't care; I'm going to shove everything into the main branch. "Using git for collaboration"... hmm, maybe this is the stuff I need to read. But by this point, I've already skimmed through five screens of info, so I'm not reading very carefully.

Yes, git caters to too many classes of people.

I've heard people talk about "everyday" document as a good table-of-contents, primarily because it first breaks down the userbase into roles and talks about common commands for each role of the user. I am not in the position to judge the quality of the document, though.

#40 lore raw

Re: git newbie problems

Quoted 6 lines · Junio C Hamano

For new people, we recommend to:

* make sure you were on a right branch (I think you are. You are on your 'master' branch and may not even have any other branches, which is fine.)

Quoted 8 lines

* make sure all your changes are committed.

before initiating a "git pull". And after a conflicted "git pull", if you choose to punt,

	$ git reset --hard

would take you back to the state before you started the pull.

If there are uncommitted changes, and there are conflicts, shouldn't it leave you in the state before the pull, especially if the uncommitted changes conflict with the merge? Git has determined that it can't present all of the conflicts to the user, so the user can't possibly resolve all of the conflicts, except by discarding new work or pushing it into the merge inappropriately.

I think that a lot of new users will pull with uncommitted changes, and they'd benefit from just being told that you're supposed to commit first and then merge. It should definitely roll back perfectly to the state before the pull if it wasn't able to present all the conflicts, since even somebody who knows what's going on is going to have to roll back here.

Possibly there should even be an option (defaulting to true) which completely blocks "pull" with uncommitted changes. Even if the in-index merge works (and the working directory is entirely unneeded), it's pretty likely that the user would do better to be in the habit of doing it in the other order anyway.

-Daniel

#41 lore raw

Re: git newbie problems

In reply to Graham Percival
Quoted 7 lines · Graham Percival

Greetings,

I'm posting these problems at Han-Wen and Dscho's insistence. I'm the documentation editor for GNU/LilyPond, so I'm reluctant to criticize other project's documentation unless I spend an hour or more seriously reading it. I'm quite willing to admit that I never seriously tried to read the docs on the overall theory of git (branches, repo, etc); I just

Branches are very useful concept. And I really like the idea of branches in git (the underlying concept of branch as lineage) and its implementation. But because CVS had seriously screwed implementation of branches, you probably didn't use it.

Quoted 2 lines

flailed around looking for magic commands to make things work. By "make things work", I mean imitating my work style with cvs:

Perhaps it would be better to at least read cvs-migration.txt
http://kernel.org/pub/software/scm/git/docs/cvs-migration.html
and all tutorials.

Quoted 3 lines

cvs co blah blah (which I simply copy and paste from savannah) while (true) {
cvs update // get changes that happened overnight

"git pull", or "git fetch". "git pull" is more like in CVS, because it merges the changes that happened overninght with your work.

Quoted 2 lines

vi foo/bar/baz.txt // or whatever editing commands you do
make; make web // or whatever testing commands you do

Those steps do not depend on version control used.

Quoted 3 lines

cvs update // get latest changes to prepare for

                       // uploading my changes.

cvs ci foo/bar/baz.txt // upload changes

With git you do this sequence not in braindead CVS "update then commit" which leads to rare commits (because you don't have time to resolve merge conflicts for example), but commit then upload changes.

"git commit -a" to commit changes (the standard format of commit message describing the change expected by history viewers is to write short one-line description of changes, separate by empty line from longer description if it is needed (it usually is): see
http://git.or.cz/gitwiki/CommitMessageConventions
(and also other pages on GitDocumentation page at GitWiki as well)).

Then "git push" to propagate your changes (or if you don't have permissions to push into repository, "git format-patch HEAD^.." and "git send-mail" to propagate your changes via email).

Quoted 7 lines

}

Once or twice a year I'll do "cvs diff" or "cvs add", but all I really want are the above commands. I figured that this should be really easy to do, so I kept on skimming through the docs, trying to find the equivalent of these really easy commands. (note that I was reading the "tutorial introduction to git")

There are some commands which CVS didn't have, and which are very useful with git: I'm talking here about "git show" (show latest change), "git log" (show kind of changelog), and gitk (graphical history viewer) or qgit (alternate graphical history viewer in Qt).

It is also of note that you can move and rename files, soemthing CVS had much problems with.

Quoted 33 lines

I should add that I've received help on the lilypond-devel list; I'm posting this in case it helps future development for git docs, not because I need more help to use git.

This case was particularly difficult because the very first time I tried to commit... err... push... err... "make my doc changes available to everybody else" (whatever the right term is), there was this merge problem.

MERGE PROBLEM

Two people (me and another person) edited the same line on Documentation/user/advanced.itely at the same time. (note that this file has existed for over a year; it's not a new file) When I tried to get the most recent changes, I'm greeted with this:
...
Trying really trivial in-index merge... Documentation/user/advanced-notation.itely: needs merge
fatal: you need to resolve your current index first
Nope.
Merging HEAD with c21d3f3e1c77722e50d994763442e6f994b03ac2 Merging:
038b7fc Misc small updates (trying to make git work). c21d3f3 Merge branch 'master' of ssh+git://[email protected]/srv/git/lilypond
found 1 common ancestor(s):
84219bb don't have input/templates/ any longer.
fatal: Entry '.gitignore' would be overwritten by merge. Cannot merge. No merge strategy handled the merge.

Quoted 6 lines

As a git newbie, I'm quite confused. OK, there's no merge strategy... so what do I do now? With cvs, the changes would be dumped into the file. I look at the file, found the conflict, and tried it again. I got the same error message, and then it occurred to me that although I changed the files in my ~/usr/src/lilypond, git might be storing these files somewhere else.

Yes, the git error messages certainly needs to be made more user-friendly. What git says here that one version has '.gitignore' file handled by version control, and second has it outside version control. At least I think what it does. "git ls-files --unmerged" or "git diff --merge --summary" should show 'true conflicts'.

By the way, which version of git do you use? I think this particular check (if it is the case of this error) was relaxed.

Quoted 4 lines

So I tried

$ git commit Documentation/user/advanced-notation.itely
Cannot do a partial commit during a merge.
You might have meant to say 'git commit -i paths...', perhaps?

Hint: usually "git reset" or even "git reset --hard" *warning: the latter would overwrite your changes since last commit! use with care) is what you want to do to 'clean up' after some interrupted command.

Quoted 19 lines

... eh? I'm trying to fix this so that you _can_ merge! Regardless, when I tried to update again, I get

$ git pull gnu master
...
Trying really trivial in-index merge...
fatal: Entry '.gitignore' would be overwritten by merge. Cannot merge.
Nope.
Merging HEAD with c21d3f3e1c77722e50d994763442e6f994b03ac2
Merging:
038b7fc Misc small updates (trying to make git work).
c21d3f3 Merge branch 'master' of
ssh+git://[email protected]/srv/git/lilypond
found 1 common ancestor(s):
84219bb don't have input/templates/ any longer.
fatal: Entry '.gitignore' would be overwritten by merge. Cannot merge.
No merge strategy handled the merge.
Quoted 1 line

Now I'm totally confused, because I definitely haven't touched .gitignore.

I'm guessing that "git add .gitignore", "git commit -a -m 'Added .gitignore'" before retyring pull/push would help in such situation.

Quoted 11 lines

SUGGESTIONS

The "tutorial introduction to git" looks like a nice document, but it assumes that you are in control of the project. For users who aren't in control (ie me) this is a problem, because it starts me skimming. "Importing a project"... nah, that's not me. "Merging branches"... I don't care; I'm going to shove everything into the main branch. "Using git for collaboration"... hmm, maybe this is the stuff I need to read. But by this point, I've already skimmed through five screens of info, so I'm not reading very carefully.

Quoted 7 lines

It would be nice to have an accompanying "tutorial introduction to contributing with git" for users (like me) who are not in control of a project.

Finally, it would be really nice if there was some mention of "resolving merge problems" in the tutorial (both in the current one and any new docs).

Check out "[DRAFT] Branching and merging with git" thread

Message-ID: <[email protected]>
http://permalink.gmane.org/gmane.comp.version-control.git/31625
http://thread.gmane.org/gmane.comp.version-control.git/31625/

which I hope would end as Documentation/tutorial-3.txt. Or you can read jdl presentation from OLS; check out GitLinks / GitDocumentation at GitWiki:

http://git.or.cz/gitwiki/

Quoted 1 line

(please CC me as I am not subscribed to the mailist)

I also am not subsribed to the mailing list, but read the list via GMane NNTP (news, Usenet) interface: see http://git.or.cz/gitwiki/GitCommunity

nntp://news.gmane.org/gmane.comp.version-control.git

P.S. For wuick answers to "what to do now" questions you might use #git channel on FreeNode.

Signature · 3 lines
Jakub Narebski
Warsaw, Poland
ShadeHawk on #git
#42 lore raw

Re: git newbie problems

Jakub Narebski escreveu:

Quoted 11 lines
Quoted 10 lines

84219bb don't have input/templates/ any longer.
fatal: Entry '.gitignore' would be overwritten by merge. Cannot merge. No merge strategy handled the merge.

As a git newbie, I'm quite confused. OK, there's no merge strategy... so what do I do now? With cvs, the changes would be dumped into the file. I look at the file, found the conflict, and tried it again. I got the same error message, and then it occurred to me that although I changed the files in my ~/usr/src/lilypond, git might be storing these files somewhere else.

Quoted 4 lines

Yes, the git error messages certainly needs to be made more user-friendly. What git says here that one version has '.gitignore' file handled by version control, and second has it outside version control. At least I think what it does.

Which is actually not true. .gitignore has been in the repo since we started using git. I have also seen this message pop up a few times in the beginning, but I can't recall why they happened.

Signature · 1 line
 Han-Wen Nienhuys - [email protected] - http://www.xs4all.nl/~hanwen
#43 lore raw

Re: git newbie problems

Quoted 9 lines · Han-Wen Nienhuys

Jakub Narebski escreveu:

Quoted 7 lines
Quoted 5 lines · Graham Percival

84219bb don't have input/templates/ any longer.
fatal: Entry '.gitignore' would be overwritten by merge. Cannot merge. No merge strategy handled the merge.

As a git newbie, I'm quite confused. OK, there's no merge strategy...

There is no merge strategy used, because problem (conflict) doesn't stem from what was committed, but from what was in working directory.

Quoted 6 lines
Quoted 6 lines
Quoted 5 lines

so what do I do now? With cvs, the changes would be dumped into the file. I look at the file, found the conflict, and tried it again. I got the same error message, and then it occurred to me that although I changed the files in my ~/usr/src/lilypond, git might be storing these files somewhere else.

Quoted 8 lines
Quoted 4 lines

Yes, the git error messages certainly needs to be made more user-friendly. What git says here that one version has '.gitignore' file handled by version control, and second has it outside version control. At least I think what it does.

Which is actually not true. .gitignore has been in the repo since we started using git. I have also seen this message pop up a few times in the beginning, but I can't recall why they happened.

I don't know if git allows to pull into dirty tree with impunity. If I remeber correctly Cogito (alternate UI for git) allows this[*1*], there is currently work on this in git (but it is not as far as I remember in git 1.4.4.1). So another possibility is induced by CVS "update then commit" mentality pulling changes _before_ commiting changes.

If this is the case, committing changes _then_ pulling would solve this problem.

Footnotes:
----------
[*1*] This is a bit error prone.

Signature · 1 line
Jakub Narebski
#44 lore raw

Re: git newbie problems

Jakub Narebski escreveu:

Quoted 5 lines

I don't know if git allows to pull into dirty tree with impunity. If I remeber correctly Cogito (alternate UI for git) allows this[*1*], there is currently work on this in git (but it is not as far as I remember in git 1.4.4.1). So another possibility is induced by CVS "update then commit" mentality pulling changes _before_ commiting changes.

it is quite possibly a side-effect of cvs-habits. Note that in the beginning I have wrestled to make git update the HEAD , eg. trying --update-head-ok

#45 lore raw

Re: git newbie problems

Hi,

Quoted 2 lines · Han-Wen Nienhuys

Note that in the beginning I have wrestled to make git update the HEAD , eg. trying --update-head-ok

Ah! That would explain many of the problems! BTW where did you see that option mentioned? We should hide this option as deep in the technical lores of the documentation, fast.

Ciao,
Dscho

#46 lore raw

Re: git newbie problems

In reply to Graham Percival
Quoted 6 lines · Graham Percival

Greetings,

I'm posting these problems at Han-Wen and Dscho's insistence. I'm the documentation editor for GNU/LilyPond, so I'm reluctant to criticize other project's documentation unless I spend an hour or more seriously reading it.

It is generally accepted that much of git documentation sucks in various ways, and people have stepped up to help fix this. The problem is that most people are already well-versed in git, which makes it harder to identify the problem areas in the documentation, and that few people unfamiliar with git post to report their problems with the documentation, or UI so that, at least on the mailinglist itself, we get little direct feedback on the documentation or UI.

Thank you from the list for your contribution.

A message that is not in the archive (sent off-list or not yet received): [email protected]

#48 lore raw

Re: git newbie problems

Quoted 7 lines · Jakub Narebski
Quoted 1 line · Graham Percival

flailed around looking for magic commands to make things work. By "make things work", I mean imitating my work style with cvs:

Perhaps it would be better to at least read cvs-migration.txt
http://kernel.org/pub/software/scm/git/docs/cvs-migration.html
and all tutorials.

I skimmed through the cvs-migration, the tutorial (part 1 and 2), and the "everyday git". I didn't notice any "how to deal with merges problems"... it was unfortunate that the merge problems arose the very first time I tried to upload my changes. If I had used git for a few days before it happened, I would have had more confidence to track down the problem (or email for help earlier!).

Quoted 4 lines

There are some commands which CVS didn't have, and which are very useful with git: I'm talking here about "git show" (show latest change), "git log" (show kind of changelog), and gitk (graphical history viewer) or qgit (alternate graphical history viewer in Qt).

Yes, I don't doubt that git has many improvements -- the main developers of my project must have had some reason for moving away from cvs! I'm speaking as a new user who wants to get very simple work done. All I wanted to do was to fix a few typos in the lilypond documentation; the information about importing cvs projects or changing branches obscured the stuff I really wanted.

Quoted 5 lines

Yes, the git error messages certainly needs to be made more user-friendly. What git says here that one version has '.gitignore' file handled by version control, and second has it outside version control. At least I think what it does. "git ls-files --unmerged" or "git diff --merge --summary" should show 'true conflicts'.

Thanks for the suggestions!

Quoted 2 lines

By the way, which version of git do you use? I think this particular check (if it is the case of this error) was relaxed.

git version 1.4.4.1
I installed it via fink/unstable on OSX.

Cheers,