Mellon
Mellon

Reputation: 38842

Git merge in my case

I created a new feature branch named new_feature from master branch to develop a new feature of my project.

My teammate also created a new branch from master, but he is refactoring the master branch version codebase on the new branch (new branch is named master_refactor).

My teammate finished the refactoring & merged the master_refactor back to master branch. So, that now the master branch has a refactored codebase.

At this point, my new feature development is also done, what should I do to merge my new feature to the current master branch without ruin my teammate's refactor work on **master** branch? (Since the old master branch codebase is still in my new_feature branch, if I directly merge back to master, will my teammate's work be ruined?).

NOTE:

when I am developing the new feature on my new branch, I also modified some code from master branch.

Upvotes: 0

Views: 37

Answers (2)

Magnus Bäck
Magnus Bäck

Reputation: 11571

You will not ruin your teammate's work by merging new_feature onto master (and even if you did, never would anything actually be lost – that's one of the benefits of having source code under version control). If you've both changed the same piece of code it'll be marked as a conflict and you'll have to resolve it manually.

Now, depending on how his and your changes intersect and what type of dependencies you have to code that he's been changing, merging the code may or may not make sense. You can certainly try, but if the code has been sufficiently refactored it might be easier to start again from the new master and reintroduce your feature. If APIs have changed substantially you may have to rewrite parts of your code completely.

Upvotes: 0

cforbish
cforbish

Reputation: 8819

No, your teammate's work will not be ruined, but there might be merge conflicts to deal with.

Upvotes: 1

Related Questions