Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
4 views
in DevOps and Agile by (19.4k points)

I want to push my local files, and have them on a remote repo, without having to deal with merge conflicts. I just want my local version to have priority over the remote one.

How can I do this with Git?

1 Answer

0 votes
by (27.5k points)

Sometimes forced push can cause some serious issues to other contributor's work. So here's a solution without force push. 

First, put your new commits in a dedicated branch

Then, reset your master on origin/master

Now all you need to do is merge your dedicated branch to master, always keeping commits from the dedicated branch (meaning creating new revisions on top of master which will mirror your dedicated branch).

This way you would be able to push master to remote without having to force anything.

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...