Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does the prompt "[master +1 ~0 -0 !]>" mean when using Git command line?

After a few Git commands, I find my command line prompt change from

[master]>

to

[master +1 ~0 -0 !]>

What does this mean?

like image 680
Wayne Wang Avatar asked Aug 17 '13 18:08

Wayne Wang


People also ask

What is Git command prompt?

At its core, Git is a set of command line utility programs that are designed to execute on a Unix style command-line environment. Modern operating systems like Linux and macOS both include built-in Unix command line terminals. This makes Linux and macOS complementary operating systems when working with Git.

Why does my terminal say Git master?

The 'git master' just means that it thinks that the directory you're in right now is a Git repository, with new, unstaged changes. All of this has to do with source control.

Can you use Git commands in command prompt?

For Windows, when installing Git through the installer, it is recommended you select the “Use Git from the Windows Command Prompt” option. This will allow you to use all git commands through your terminal (CMD, PowerShell, Anaconda) rather than having to use Git's personal terminal, Git Bash.

What does Git status tell you?

The git status command displays the state of the working directory and the staging area. It lets you see which changes have been staged, which haven't, and which files aren't being tracked by Git.


2 Answers

This represents the number of files:

  • added (+)
  • modified (~)
  • deleted (-)
  • conflict (!) (from alisa's answer)

You can see a powershell version of that prompt here.

powershell prompt

Those represent the status before commit (added means added to the index, or 'staged')

Here is a more complete version of that prompt, which also display the number of commits ahead or behind an upstream repository.

commit ahead

When you do some changes and commit them, your state is 1 commit ahead of remote. It is very useful to know how many commits you have unpushed.

like image 85
VonC Avatar answered Oct 22 '22 00:10

VonC


And:

  • Conflicts ( ! )

Usually there is no conflict, but sometimes it occurs (for example when a file is changed in both your local repository and the online repository, and you want to pull. So Git doesn't know which one to keep).

In these cases, you have to correct and save the conflicting file (that is already marked by Github, showing the conflicting lines) manually.

like image 33
Alisa Avatar answered Oct 22 '22 01:10

Alisa