git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Problems with branches

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
Jan 27, 2007, 00:03 UTC
Message-ID
<Pine.LNX.4.63.0701270059380.22628@wbgn013.biozentrum.uni-wuerzburg.de>
In-Reply-To
<4b73d43f0701261551oef411f7tfd5cdbfdce7f6abc@mail.gmail.com>
Hi,
On Fri, 26 Jan 2007, John Rigby wrote:
Show 23 quoted lines
> I'm having trouble doing something so simple that it is in the
> tutorial but for some reason it does not work for me.
> The following script does basically the same thing that is
> outlined in the "Managing branches" section of the tutorial.
> 
> mkdir foodir
> cd foodir/
> git-init-db
> echo bar > bar
> git-add bar
> git-commit -m "Initial bar"
> git-branch mybranch
> git-branch
> git-checkout mybranch
> echo bar2 >> bar
> git-commit -a -m "Added line bar2 to bar in mybranch"
> git-checkout master
> cat bar
> echo bar3 >> bar
> git-commit -a -m "Added line bar3 to bar in master"
> git-commit -a
> git-diff master mybranch
> git-merge mybranch
What version do you run? I get this running your script:
$ mkdir foodir
$ cd foodir/
$ git-init-db
Initialized empty Git repository in .git/
$ echo bar > bar
$ git-add bar
$ git-commit -m "Initial bar"
Created initial commit bca2eed2306297ec17abb5a9a9fd916f18bdd7f8
 1 files changed, 1 insertions(+), 0 deletions(-)
 create mode 100644 bar
$ git-branch mybranch
$ git-branch
* master
  mybranch
$ git-checkout mybranch
$ echo bar2 >> bar
$ git-commit -a -m "Added line bar2 to bar in mybranch"
Created commit 48c9ce01b39faabc778bcc2ca52f44db54670809
 1 files changed, 1 insertions(+), 0 deletions(-)
$ git-checkout master
$ cat bar
bar
$ echo bar3 >> bar
$ git-commit -a -m "Added line bar3 to bar in master"
Created commit 496e810b70c3dba56d002ad9bec61028af7de821
 1 files changed, 1 insertions(+), 0 deletions(-)
$ git-commit -a
# On branch master
nothing to commit (working directory clean)
$ git-diff master mybranch
diff --git a/bar b/bar
index 77914eb..46ffc55 100644
--- a/bar
+++ b/bar
@@ -1,2 +1,2 @@
 bar
-bar3
+bar2
$ git-merge mybranch
Auto-merged bar
CONFLICT (content): Merge conflict in bar
Automatic merge failed; fix conflicts and then commit the result.
Previous: John RigbyNext: Junio C Hamano
Message 2 of 6 in “Problems with branches”
  1. John RigbyJan 26, 2007
  2. Johannes SchindelinJan 27, 2007
  3. Junio C HamanoJan 27, 2007
  4. John RigbyJan 27, 2007
  5. Jeff KingJan 27, 2007
  6. Junio C HamanoJan 27, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.