Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does git [master +2 ~1 -0 !] mean?

Tags:

git

powershell

I'm using the "Github For Windows" shell and was trying to commit something and came across what looks like an error:

C:\Path\Name\ [master +2 ~1 -0 !]> 

What does +2 ~1 -0 ! mean?

NOTE: I fixed the error by modifing every file in the directory and re commiting and pushing, now it's just [master], but I still don't understand the numbers.

like image 795
Christopher Avatar asked Aug 18 '12 19:08

Christopher


People also ask

What does git master mean?

In Git, "master" is a naming convention for a branch. After cloning (downloading) a project from a remote server, the resulting local repository has a single local branch: the so-called "master" branch. This means that "master" can be seen as a repository's "default" branch.

What is M flag in git branch?

-M is a flag (shortcut) for --move --force per the docs page on git branch . It renames the branch main (since the default branch name for repositories created using the command line is master , while those created in GitHub [starting in Oct.

Why does Gitbash say Master?

You are seeing master because you created a git repository at the current path using the git init command. Always create git repositories in the folders containing project files. Consider running rm -rf . git command.

What does rebase mean in git?

What is git rebase? Rebasing is the process of moving or combining a sequence of commits to a new base commit. Rebasing is most useful and easily visualized in the context of a feature branching workflow.


2 Answers

This is not an error, just some helpful information.

I suppose you are using Github For Windows - it uses posh-git by default, and the prompt is explained in the README of posh-git itself:

+ = Added files
~ = Modified files
- = Removed files
! = Conflicted files

Go through the README and you can see how it relates to the git status output.

like image 80
manojlds Avatar answered Sep 25 '22 03:09

manojlds


That prompt probably meant:
In your current git branch - master, you had added two files +2, modified one ~1 and removed zero -0.
! signifies you are currently at the root of the repository. Check this comment for more info.

Not sure which shell you are using - But you may want to check the PROMPT and PS1 environment variables to find what those items mean in your prompt.

The prompt got reset to just [master] - once you had committed all the changes, as you mentioned in your questions.

PROMPT environment variable is the one used by the windows shell cmd, and PS1 is used by unixy shells - like bash.

Edit: Totally missed the powershell tag you put in there - I'm not a windows guy - but looks like in powershell you create a prompt function - check this link: http://www.johndcook.com/blog/2008/05/12/customizing-the-powershell-command-prompt/

like image 39
xk0der Avatar answered Sep 25 '22 03:09

xk0der