Hassan Farooq
Hassan Farooq

Reputation: 71

How to merge conflicted files to my repository

I have a master repository that is used by two users, now when I push my code it warns me to resolve conflicts.

I want to merge my code into the existing code with git commands but I don't know how to fix this problem.

Upvotes: 0

Views: 428

Answers (1)

Sajib Khan
Sajib Khan

Reputation: 24156

$ git commit -am <message>       # add & commit your local changes
$ git pull origin master         # pull the latest codes
$ git status                     # see the files that have conflicted (untracked files)

# If you want to keep your changes then
$ git checkout . --ours

# Or, if you want to keep remote changes
$ git checkout . --theirs

$ git commit -am <message>           # add & commit with a new message
$ git push origin master             # push to remote  

Upvotes: 1

Related Questions