1

I opened a list of branches in the terminal(iTerm), and then I don't know how I can go to the current branch in the current situation.

enter image description here

UPD:

The problem is to get out of the list of these branches, that is, to close this editor

Morozov
  • 4,968
  • 6
  • 39
  • 70
  • 1
    You are in the current branch, right? The branch marked with an asterisk is your current branch. What exactly would you like to achieve? – Zois Tasoulas Jan 23 '21 at 00:54
  • 2
    I *think* you intended to ask "how do I exit my pager". (The answer depends on which pager you're using.) See, e.g., [this related question](https://stackoverflow.com/q/59940755/1256452). – torek Jan 23 '21 at 02:46
  • @torek The pager on the screen is obviously `less` – phd Jan 23 '21 at 12:23
  • https://stackoverflow.com/q/48341920/7976758 – phd Jan 23 '21 at 12:24
  • 1
    @phd: I think it is `less` too, but by looking up how to *set* the pager as well as its options, the OP can change the pager if desired. :-) – torek Jan 24 '21 at 00:24

6 Answers6

6

To get out of this view in the terminal you just have to press q. It's as simple as that.

vveil
  • 321
  • 1
  • 9
  • 'q' will exit but the list of branches will be deleted, and that was the question, how to keep them? – Paul Pacurar Mar 11 '23 at 14:55
  • As @Prayson W. Daniel commented you could use `git branch | cat` to just output the branches to your terminal. – vveil May 17 '23 at 09:04
1

I find pressing q every time I run git branch to quit tendentious. Now I do

git branch | cat

I just want to list my branches :)

Prayson W. Daniel
  • 14,191
  • 4
  • 51
  • 57
0

For what I understand, you are in "dev" branch, this is your current branch, marked by "*".

If you want to switch to another branch you can type:

git checkout master // master or other existing branch

If you want to create another branch:

git branch newBranch

You can find more about these branch related commands on the official documents of git here: git checkout git branching

EDIT: If you are trying to quit the branch listing window on the terminal, I suppose you would use the cmd + Q command for that. iTerm2 doc

Marcus Castanho
  • 145
  • 1
  • 3
  • 9
  • yes, i am trying to quit the branch listing window on the terminal and cmd + Q doesn't work for me. – Morozov Jan 27 '21 at 14:17
0

When you list all branches using git branch it will display local branches when you run git branch -a it will display local as well as remote branches. Now if you want to switch branch you have to use this command.

git checkout branch-name

In your case, you are already at dev branch just run git checkout master to switch to master

Extra: If you want to create a new branch just run git checkout -b branch-name. This will create new branch and switch to it as well.

Hadi Mir
  • 4,497
  • 2
  • 29
  • 31
0

You can do git checkout like

git checkout

To go on particular branch.

If you want to know your current branch, then you can see that in round bracket.

Or else you can fire command like git branch. This will list down all the branches in repository. And the one which is in green color, that is your current branch.

Refer this video to get fair idea about version control system and to understand the basics of GIT.

https://youtu.be/et_KFeBad28

Mark
  • 1
0

In case your question is about vi or vim, that's a defacto unix/linux text editor and is weird to use for 'normal' people, but it has some 'modes', one being for various commands, and a different one to insert text. Toggling between them is made when you press 'Esc', then type ':'. Now you can close, but when you close you might want to write (w) or abort changes. Exiting is made via 'q' command. If you have changes you need 'qw', but if you have and want to abort them you have to use exclamation mark: 'q!'

Paul Pacurar
  • 145
  • 12