简体   繁体   中英

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?

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.

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM