Morozov
Morozov

Reputation: 5260

How do I exit my editor/pager with list of branches?

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

Upvotes: 2

Views: 2546

Answers (6)

Paul Pacurar
Paul Pacurar

Reputation: 179

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!'

Upvotes: 0

Prayson W. Daniel
Prayson W. Daniel

Reputation: 15578

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 :)

Upvotes: 2

vveil
vveil

Reputation: 330

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

Upvotes: 6

Mark
Mark

Reputation: 1

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

Upvotes: 0

Hadi Mir
Hadi Mir

Reputation: 5133

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.

Upvotes: 0

Marcus Castanho
Marcus Castanho

Reputation: 143

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

Upvotes: 0

Related Questions