0

I'm trying to explain my issue. I'd like to merge a local (not under git versioning) project with the changes in its master git branch.

In other words, I did some local modifications to a project (but I did not use git). Meanwhile some modifications were added to the master branch. Now, I'd like to update my local version of the project doing a "merge" between my local version and the one in the git repository.

What I've tried:

  • I've created a branch of the master;
  • I've copied my modifications on the new branch;
  • I've tried to merge the master on the new created branch (and obviously it doesn't work)

If I use git-diff between new branch and master I see all differences. I'd like to have a branch with such difference, in which I resolve conflicts caused by the differences.

Any suggestion to solve my issue?

Gilberto T.
  • 358
  • 6
  • 19

2 Answers2

0

If you can pinpoint the commit in master on which you based your local changes, you could checkout this commit, create an "old" version of master "master_old"-branch, copy your changes into it and commit them. Then you could just merge master into your branch and solve the resulting conflicts.

raeken
  • 1
  • 1
0

It seem complicated, perhap you can use some visual merge tool to help you.

Or if you want to go to the last version without new changes, just run git reset --hard HEAD~

mergeconflicts

visual mergetool

Community
  • 1
  • 1
ColorWin
  • 56
  • 1
  • 7
  • According the steps I did I've not conflicts. I want that all diffs between master and my branch will be treated as conflicts. – Gilberto T. Sep 27 '16 at 10:41
  • You might can do that manually by use `git add -p` then `y` for add this time, `n` for no add this time, `s` for separate little, then `commit`. So you can add your before changes, commit old, then add your new changes, commit new. – ColorWin Sep 28 '16 at 01:55