cfischer
cfischer

Reputation: 24912

What does "+1/-1" mean on git's output?

If I try to interactively add a file to git,

git add -i

I get this output:

*** Commands ***
  1: [s]tatus     2: [u]pdate     3: [r]evert     4: [a]dd untracked
  5: [p]atch      6: [d]iff   7: [q]uit   8: [h]elp
What now> 1
           staged     unstaged path
  1:    unchanged        +1/-1 index.html

I'm assuming this +1/-1 means that there's one unstagged file, but why the +1/-1? What doe sit mean? Why not just 1?

Upvotes: 4

Views: 114

Answers (3)

xero
xero

Reputation: 4319

this is the commit status. and overview of the insertions and deletions to the repo in this commit. throw the stat or shortstat flag to git log to view them for all your previous commits.

git log --stat

Upvotes: 1

John Zwinck
John Zwinck

Reputation: 249153

It is telling you how many lines are added/deleted. +1/-1 likely means you modified a single line.

Upvotes: 5

Ryan Bigg
Ryan Bigg

Reputation: 107728

This is indicating that index.html has had one line removed, and one line added. This is typical for Git when you change a part of a line.

Upvotes: 10

Related Questions