In my situation, I have a webapp (django) project that has a bunch of staged files I'd not like to discard or commit, but at the same time, I have a file (a sqlite file) that I want to add and commit. At this moment since I have no idea how to do this, I'm taking a way to manually copy (cp) the file to an another non-git directory with renaming, but this is apparently not an efficient practice. So what can I do? Thanks.
CodePudding user response:
Specify the file that you want to commit:
git commit -m 'commit the file' -- /path/to/file
This will commit the specified file but other staged files will not be committed.
CodePudding user response:
stash the staged files, then add and commit the file you want and pop the stash back.