-1

I've created a .gitignore file but I'm not sure if it is working or not.

Currently i have this in the gitignore file in the DEMOPROJECT directory

*db.*
__init__.py 

And I'm getting this output in the windows command line

(venv) C:\..\..\PycharmProjects\WebP1\DEMOPROJECT>git checkout newMast
Switched to branch 'newMast'
D       .gitignore
M       db.sqlite3

What is the significance of the D and M?

Joelad
  • 492
  • 3
  • 12
  • 2
    `D` for deleted, `M` for modified. ([doc](https://git-scm.com/docs/git-status#_short_format)) – Romain Valeri Sep 18 '19 at 07:33
  • Ah so my gitignore file isnt made correctly? – Joelad Sep 18 '19 at 07:35
  • You are switching branches without first running `git commit`. Sometimes this is allowed, and sometimes it's not. When it *is* allowed, uncommitted changes are being carried over. See https://stackoverflow.com/questions/22053757/checkout-another-branch-when-there-are-uncommitted-changes-on-the-current-branch – torek Sep 18 '19 at 16:05

2 Answers2

2

That is the result of the short version of git status.

Based on https://git-scm.com/docs/git-status,

  • ' ' = unmodified
  • M = modified
  • A = added
  • D = deleted
  • R = renamed
  • C = copied
  • U = updated but unmerged

You can learn more abot the meaning of each stage at https://git-scm.com/book/en/v2/Git-Basics-Recording-Changes-to-the-Repository.

Edit: I think for your case it seems that the db.sqlite3 has been tracked beforehand, so even though you have added it in .gitignore, the changes would still be tracked. You can see how to fix it at How to make Git "forget" about a file that was tracked but is now in .gitignore?.
Also, it seems that the .gitignore file is somehow deleted before you perform the checkout?

Hans Tananda
  • 169
  • 8
  • Thank you for the help! Yeah I'm trying to out why it is being deleted. This command line django git is all new to me in the last few days. – Joelad Sep 18 '19 at 08:35
  • 1
    Hmm I suggest to play around with git commands first to familiarize with it. And I think there are quite a lot of `.gitignore` templates for Python and Django, so you can actually add it first after initializing a new repository. – Hans Tananda Sep 18 '19 at 08:53
  • Yeah its loads of fun. I feel like I'm getting there – Joelad Sep 18 '19 at 09:03
1

D for deleted, M for modified You need to commit .gitignore to your branch.

EvilCaT
  • 139
  • 1
  • 2