0

Suddenly my local git repository bugged in a way that it didn't response to git commands, So with the help of a great professional here was able to reset, re-link it to the remote address at DevOps server.

Link to the previous topic: Previous topic

Now having some conflicts when trying to Cherry Commit my local repository changes to its DevOps location.

Used this:

git cherry-pick theversion

now it seems pending.

Please have a look at the below image:

The screenshot

Don't know what should I do now. I want all the current changes and files apply as it is in the local working project. Blame? Stage? Resolve? Should I select each individually? If those 14 in the below section are the conflicts, why I cannot point that I want to prioritize everything I have here to the remote version?

Considering this:

Resolve merge conflicts

I know that I didn't do a merge, but why here there is no "Take Source button" like what it said? It can be a similar situation.

Kasrak
  • 1,509
  • 4
  • 24
  • 48

1 Answers1

1

It seems like the commit you are cherry-picking and your local commits have a conflict (you both changed the same files, and git is asking how to handle the conflicts).
If you want to take the changes from the cherry-pick commit, while discarding your changes, run these commands in the command line for all the files:

  1. git checkout --theirs
  2. git add < filename >

After running this for all files, run:
git cherry-pick --continue

Source: checkout cherry pick

Eyal D
  • 169
  • 1
  • 15
  • Thanks Eyal, will try that in some hours, should checkout ours or theirs? – Kasrak Feb 19 '20 at 03:32
  • 1
    Ours keeps the changes you made locally, theirs keeps the changes that were fetched from the remote repository. It's up to you to decide. Another option is manually handling the conflicts, or using tools like meld. – Eyal D Feb 19 '20 at 05:05
  • You can also use visual studio to resolve conflicts. To be honest, I never tried – Eyal D Feb 19 '20 at 05:06
  • I want my local changes to apply. so should checkout ours, right? – Kasrak Feb 19 '20 at 08:12
  • 1
    yes. Read this https://stackoverflow.com/questions/161813/how-to-resolve-merge-conflicts-in-git – Eyal D Feb 19 '20 at 08:18
  • Thanks, btw another question here, should I add each new file after the checkout like this pattern: "git add " ? – Kasrak Feb 19 '20 at 08:26
  • Tried it now, got this error: D:\cccc\HIH>git checkout --ours fatal: '--ours/--theirs' cannot be used with switching branches – Kasrak Feb 19 '20 at 08:56