threads / discuss / 47716

How juggle branches?

Subject: How juggle branches?

## tl;dr

4 messages between Jan 29, 2018 and Feb 8, 2018.

replies: 3people: 3as markdown or json

Andrzej· Jan 29, 2018, 21:24 UTC · lore
First, I develop program which uses mysql in branch master.
Next i change name this branch to before_hbase, and began develop HBase 
in branch master. I also develop before_hbase.
Now, instead HBase will be MapR-DB which will before_hbase , not master 
succesor.
How do:
- change before_hbase to master
- old master to hbase
- develop MapR in mapr branch
?
I am in master branch and am changing to hbase:
git checkout -b hbase
git push origin hbase

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

I must use rebase? I hear, that rebase can be used only in private (.git), not github repositories. If I change to master and copy files and next commit - change will not atomic.

Patryk Obara· Jan 30, 2018, 00:16 UTC · re: Andrzej · lore

Re: How juggle branches?

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
Andrzej· Feb 8, 2018, 14:03 UTC · re: Andrzej · lore

Automatic parameters completion

I have Linux Mint and its terminal besides usual completion (add file name when type first letter and press tab) also can complete git parameters. How is doing this? Bash knows git or bash has special interface to completion and git uses it? I want in my Linux program apply this mechanism.

Stephen R Guglielmo· Feb 8, 2018, 14:22 UTC · re: Andrzej · lore

Re: Automatic parameters completion

On Thu, Feb 8, 2018 at 9:03 AM, Andrzej <borucki_andrzej@wp.pl> wrote:
Show 5 quoted lines
> I have Linux Mint and its terminal besides usual completion (add file name
> when type first letter and press tab) also can complete git parameters. How
> is doing this? Bash knows git or bash has special interface to completion
> and git uses it?
> I want in my Linux program apply this mechanism.

Various shells include support for completion of git parameters. These completion functions may be enabled by default in your distribution. For example, zsh has vcs_info[1]. There are also scripts included in git (contrib/completion) [2] to do this.

[1] http://zsh.sourceforge.net/Doc/Release/User-Contributions.html#Version-Control-Information [2] https://github.com/git/git/tree/master/contrib/completion

← back to recent threads