Matthew Colley
Matthew Colley

Reputation: 11446

Git pulled from wrong branch

I have two branches on the server A branch called R2 and a branch called DEV I inadvertently logged into the wrong server, into the repository and performed a GIT PULL ORIGIN DEV however the repository was on R2. SO I realized my mistake and then tried to correct my mistake by doing a GIT PULL ORIGIN R2 However I end up with a bunch of file names and the error

U   view/private_api/ipn.phtml
M   view/reports/menScholarshipForm.pdf
M   view/reports/printProCard.phtml
M   view/reports/printSanction.phtml
M   view/sanctionDetailRoster.html
M   view/sanctionDetailVerify.html
M   view/verifyMembership.phtml
Pull is not possible because you have unmerged files.
Please, fix them up in the work tree, and then use 'git add/rm <file>'
as appropriate to mark resolution, or use 'git commit -a'.

I dont mind going in and resetting each file manually, just unsure how to fix my mistake. thanks

Upvotes: 4

Views: 1741

Answers (1)

johnsyweb
johnsyweb

Reputation: 141800

git pull is just shorthand for git fetch followed by git merge FETCH_HEAD. It looks like you encountered some conflicts at the git merge stage.

git merge --abort will abort the merge process and try to reconstruct the pre-merge state.

To reset R2 to what is in origin/R2:

git checkout R2
git fetch origin
git stash # because it's always a good thing to do
git reset --hard origin/R2

Upvotes: 6

Related Questions