Git Add

Oct 30, 2020 / Updated on Oct 30, 2020

Git Version 2.x

Command New File Modified File Deleted File Summary
git add -A Y Y Y Stage new, modified, deleted
git add . Y Y Y Stage new, modified, deleted
git add --ignore-removal . Y Y N Stage new and modified files (Deleted files not staged)
git add --u N Y Y Stage modified and deleted files (Added files not staged)
  • To stage all changes use git add . or git add -A
  • To stage all except deleted files git add -ignore-removal
  • To stage all except new files git add --u

Git Version 1.x

Command New File Modified File Deleted File Summary
git add -A Y Y Y Stage new, modified, deleted
git add . Y Y N Stage new and modified files (Deleted files not staged)
git add --u N Y Y Stage modified and deleted files (Added files not staged)
  • To stage all changes use git add -A
  • To stage all except deleted files git add .
  • To stage all except new files git add --u

Note the difference in git add . between version 1 and 2

comments powered by Disqus
Categories:
Tags: