Back

Explore Courses Blog Tutorials Interview Questions
0 votes
1 view
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.

Welcome to Intellipaat Community. Get your technical queries answered by top developers!

28.4k questions

29.7k answers

500 comments

94k users

Browse Categories

...