Reputation: 15404
I am new to Git and am really struggling to get my head 'round how it works.
Here's the situation: I worked on a simple .css change, and pushed it to Github. No dramas there. A few days later I realised I had made a mistake in the CSS file and so checked out that branch to fix my mistake. I fix the code and do a git status
just to check everything, but I see about 100 other files appear in my 'Changes to be committed list'.
None of these files have anything to do with what I've been working on, so I figure someone might have added to my branch on GitHub. I go to GitHub and check but on my branch's page but I only see my 1 file and 1 commit. I don't know where these other files have come from, but obviously it was probably when I checked out.
Would anyone know what's happened here?
Also, how do I push just my files? I don't want to push a whole heap of others.
Upvotes: 0
Views: 100
Reputation: 543
git add file1.css file2.css file3.css
git commit -m "msg"
git push
Upvotes: 1
Reputation: 1353
If you had other files on your local directory, you likely did a git add .
. In general, add the specific file you want to track in git. git reset
will undo all staged changes. Then commit the change to the file you want to change, and push.
Upvotes: 2