How to Force Git to overwrite local files on pull?

How to Force Git to overwrite local files on pull?

Let us consider a situation,

  • We are creating a website with many features by two developers ‘A’ and ‘B’. And currently the template is being
  • created by the dev ‘A’.
  • The dev ‘A’ forgets to add the icons in source control, but puts them in a directory.
  • Later on dev ‘B’ adds the icons under the source control and pushes them to Github.
  • But nowdev ‘A’ is unable to pull the files.
  • So in such a situation, in order to update these files locally, dev’A’ would have to use the below commands,

    git fetch — all

    This command will fetch remote changes from all branches to local repository and it does not affect the working directory.

    git reset — hard origin/master

    This command will remove all uncommitted changes from your working directory.

One thought on “How to Force Git to overwrite local files on pull?

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>