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

Problems with branches

From
John Rigby <jcrigby@gmail.com>
Date
Jan 26, 2007, 23:51 UTC
Message-ID
<4b73d43f0701261551oef411f7tfd5cdbfdce7f6abc@mail.gmail.com>

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

Here is the output, everything seems fine until the git-merge which complains "fatal: Needed a single revision":

+ mkdir foodir
+ cd foodir/
+ git-init-db
defaulting to local storage area
+ echo bar
+ git-add bar
+ git-commit -m 'Initial bar'
Committing initial tree ee314a31b622b027c10981acaed7903a3607dbd4
+ git-branch mybranch
+ git-branch
* master
  mybranch
+ git-checkout mybranch
+ echo bar2
+ git-commit -a -m 'Added line bar2 to bar in mybranch'
+ git-checkout master
+ cat bar
bar
+ echo bar3
+ git-commit -a -m 'Added line bar3 to bar in master'
+ git-commit -a
nothing to commit
+ 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
fatal: Needed a single revision
Usage: /home/jrigby/bin/git-merge [-n] [--no-commit] [--squash] [-s
<strategy>]... <merge-message> <head> <remote>+

Could some kind soul help me pull my head out?

Thanks
John
Next: Johannes Schindelin
Message 1 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.