I have files that are not identical to the files from the remote repository. How can I merge the repository in my local, without changing the local, and adding changes from the remote. I did it through master: master through git pull, and then at the prompt git reset --hard, as I understand it, it will delete all my local and replace it with the remote one.
- Use branches. - Nick Volynkin ♦
1 answer
create a temporary branch, for example, so git checkout -b temp will create a temp branch and switch to it. then spoole the git pull origin temp you need there. as a result, you will have your main master branch with your development and a temp branch with downloaded alternative code.
as a result, you will have two versions that need to be combined. If the changes in two branches affect the same parts of the files, then this will not work automatically, because the program does not understand which of these versions suits you better - such conflicts are solved manually by selecting the necessary code and removing unnecessary.
More details on the link: Fundamentals of merger conflicts