Git Force Pull (ignore Local Changes)
For situations where we would like to ignore the local changes made to local git repo and just want to override it with the Remote upstream branch
when you run Git pull origin main For e.g
error: Your local changes to the following files would be overwritten by merge:Filename.txt
Please commit your changes or stash them before you merge.
Aborting
Solution :
Execute the Following :
git reset –hard HEAD (Note : it is double dash – -hard “
git pull origin main
Difference between git clone and git fork
git clone : Downloads a copy of a GitHub repo to your local machine .
git fork : Creates a copy of the Github repo to your git hub account . you can then clone this fork locallly and submit changes to the forked remote repo and also you may submit a pull request to the original repository owner to merge your changes if you intend to contribute to the original repo .