( Being new ,i am not claiming that its not working correctly , obviously there's issues with my understanding , hence the word expected ) ...
Lemme explain properly.... Lets say i clone a git repo which has 10 files inside it.
Currently as i have just cloned , both my local copy and github repo are exactly same.
I now do two changes - One in my github repo and other in my local copy. eg. A) I added file 11 and 12 in my github repo . B) I delete file 9 from my local copy .
Now i want my local copy to get synced with my github repository such that it exactly mirrors it ( basically that same state if i would have deleted my local copy and recloned it )
ie A) it should add new files 11 and 12 from git repo B) it should bring back file 9 present in git repo
After googling a bit , i found that we can use git pull origin master to update our local copy of repo But running that said - already up to date...
git remote -v had the remote -origin pointing to my github repo so that's absence of remote is not the issue..
I guess i am missing something. What would be the proper command to acheive the 2 tasks that i mentioned above .
To reset the local repo to match the remote, while discarding any uncommitted changes (and potentially orphaning some commits, so that they might be discarded by a future garbage collection), you could do:
git fetch origin
git reset --hard @{u}
The first command retrieves the commits from the remote, and the second resets the local repository to make it match the remote.