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

Re: How juggle branches?

From
Patryk Obara <patryk.obara@gmail.com>
Date
Jan 30, 2018, 00:16 UTC
Message-ID
<1fd71dd9-f54a-16dc-5521-f6f4e7d6fc33@gmail.com>
In-Reply-To
<29b0272d-7854-592d-5e1c-3a4f0d347bd1@wp.pl>
On 29/01/2018 22:24, Andrzej wrote:
> I am in master branch and am changing to hbase:
> git checkout -b hbase
> git push origin hbase

These two commands create new branch called "hbase" in your local repo, and then in remote repo - so probably not what you wanted to do.

> now worse:
> I am in branch before_hbase and need change to master
> git checkout -b master  - not works because master exists

"git checkout -b name" creates new branch called "name", starting in your latest commit and switches you to this new branch.

"git checkout name" switches your working tree to branch "name".

So just drop "-b". You can read more in manual for git-checkout: https://git-scm.com/docs/git-checkout

(in polish) Jeśli masz jakieś konkretne pytania, to możesz napisać do mnie po polsku :).

-- 
| ← Ceci n'est pas une pipe
Patryk Obara
Previous: AndrzejNext: Andrzej
Message 2 of 4 in “How juggle branches?”
  1. AndrzejJan 29, 2018
  2. Patryk ObaraJan 30, 2018
  3. Automatic parameters completionAndrzej, Feb 8, 2018
  4. Stephen R GuglielmoFeb 8, 2018

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.