Reputation: 2040
I added a new file to my master repository and edited a few, I only committed the ones I edited. Now the commit history on repo I pushed to is showing file changes in the edited files I added AND the new one I I created even though I did not add the new one.
TLDR: I did not add a newly created file to a commit but it was included in push anyway.
Upvotes: 0
Views: 372
Reputation: 185671
You did in fact add it. You probably typed the wrong thing and didn't realize it (e.g. git add -A
instead of git add -u
, the -A
picks up new files whereas -u
only picks up modified ones). If you want to avoid issues like this in the future, you might want to get in the habit of using git diff --cached
before committing to verify what you're about to commit, or using git show
after committing to review your commit before you push it anywhere. Also note that the editor for the commit message will show a summary of the files included in the commit, so you can check that and make sure it's not including files you didn't intend to commit.
Upvotes: 3