Reputation: 116
Aloha, guys!
Have some problems with GIT.
I'm using git bash and have 2 files which are not included my commit. How Do I include them? Bash is typing me that:
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)
modified: IS_ERSB/Default.aspx.cs
modified: IS_ERSB/IS_ERSB.csproj
I'm try to reDownload source, but when it completed, this files is NOT modified, but it is.
Upvotes: 0
Views: 398
Reputation: 45649
If it seems like you're get confusingly off-topic answers, it's because your question title doesn't match what you said in your question. Maybe it's just a matter of familiarity with git terminology, but here are some things we can conclude (mostly from you screenshot, which is what I'm treating as the definitive source of information):
In a fresh clone, you get these files. Therefore the are in the existing commits. They show up as "modified" in that freshly-made clone, where obviously they haven't been modified (assuming this screenshot has not been edited to deceive us). That usually means you have some inconsistent setup with respect to how files are filtered when moving between the index and work tree. I'd say the most common issue is line endings.
You could run git diff
to see what is different. That might offer more clues.
That said, it is unclear what you're trying to accomplish. I assume you'd like the status not to show unmodified files as modified, but beyond that if you indeed have a commit you haven't added these to, and "can't" add them to as the question title says, then... what have you tried that shows you can't add them? What commands did you give and what were the results?
Upvotes: 0
Reputation: 116948
Your question is a little unclear as to if you mean "dont add to commit. " they haven't been added or if you mean that you dont want them added. So here is a solution for both.
Keep changes
As stated in the message you posted
(use "git add ..." to update what will be committed)
So if you want to keep the changes use git add by adding a . at the end it adds everything.
Git add .
Will add the files to staging for commit Then do the following to commit the changes.
git commit file -m "commit message"
Remove changes
As stated in the message you posted
(use "git checkout -- ..." to discard changes in working directory)
So If you want to destroy the changes. use git checkout with the file name to pick the file you dont want to save changes for.
git checkout IS_ERSB/Default.aspx.cs
Will check out the file again there by destroying any changes made to the file you checkout.
There is also git reset
Upvotes: 1
Reputation: 599
First add the file since you have modified and the commit like below. Anytime you modify the file you have to go through the process of adding before committing.
git add IS_ERSB/Default.aspx.cs
git commit file -m "commit message"
I highly recommed the Git plugging for visual studio, see link for more info: Get Started with Git and VSTS
Upvotes: 0