I'm honestly a Git novice so pardon me if I'm overcomplicating things ehre.
1.) I have file A in my working directory that has 10 lines. the same file is in remote repo too with 8 lines
2.) When I pull the file A from remote repo, git says "your branch is up to date with origin/remote-branch".
Step 2 did not get rid of the changes I have in my local but Git does not complain about additional change that I have in my local either. To me, it looks like I have all the updates from remote. Let's say a couple days after I make change to another file B (from the same branch) and try to commit them by using "git add ." the 3 additional lines that were in my file A is also now pushed to the remote inadvertently. Of course git status would have shown me that there are 2 modifications but if I forget about the change to file A from 2 days ago and if I were to think that file B is the only change I did just now and did a "git add ." then I'm in trouble.
My question really is, is git checkout -- fileA the only way to ensure I exactly match the remote fileA with my fileA? I also see git pull -f but that's risky to do. What's the safest way for me to know that git pull still did its job while there are some additional changes I have in my working directory? Should not git stop me from even pulling? What's weird is sometimes it does say "your local changes could be lost with the pull" but it does not do that all the time when the file is reasonably clean and if git pull would not impact any of my local changes. I'm just trying to see how do I avoid such error with inadvertently pushing something to the repo that I was just experimenting with a file in a branch. I was hoping pull would either clean it up or error out always but it does not seem to be true.
Thanks for your help!