git - Solve cherry-pick conflicts between diverged branches without committing -


i got 2 branches (master , feature) diverged.

master  - c1 - c3             \ feature      c2 - c4 - c5 

c2 , c4 dirty commits temporary code, don't want have final merge/rebase of 2 branches.

i perform a:

git checkout master git cherry-pick c5 (last commit feature branch) 

but time have c3 conflicts , cannot pick commit.

what tried rebasing c3 feature branch, not have conflicts when cherry-picking.

git checkout feature git rebase master 

now got this

master  - c1 - c3                 \ feature          c2 - c4 - c5 

seems fine, if try cherry-pick again onto master still conflicts (on empty space removed files).

git telling me resolve conflicts, add files, , commit. can solve conflicts manually, don't want commit them conflict resolution.

i want avoid commits in history not related directly implementations. not know write commit message.

  • why still conflicts after rebase?
  • and how can c5 merged/cherry-picked master without additional commits?

i prefer cherry-pick cause can avoid 'useless' merge commit , have commits regarding code changes. after delete branch, after while i'm sure don't need anymore

[[ edit ]]

the wierd behaviour c5 , c3 conflict on files not changed on c3.

infact, detected conflicts empty on master branch

<<<<<<< head ======= [ added code ..................... ] [ .......... ................ ] [ ............... 'feature' branch ] >>>>>>> 581g52d... "commit message 'feature' c5 " 

what need 'solve' deleting conflict tags conflicting files.

  • i don't reasons of conflicts
  • i solve manually , merge/cherry-pick without having create new commits
    • cause commit solve conflicts branch in future deleted
    • when deleted branch, commit have no sense/position in repository history

[[ edit 2 ]]

moreover, if try `git cherry-pick master/c3 feature get:

no changes added commit (use "git add" and/or "git commit -a") previous cherry-pick empty, possibly due conflict resolution.

i don't why have conflicts in opposite direction (from feature master)

[[ edit 3 - retrying beginning! ]]

here tried too.

  • made 2 copies of master branch, c3 last commit, named: master_copy , repeat_feature

    • git checkout master / git branch master_copy / git branch repeat_feature
  • cherry-picked every commit feature branch, until c5, repeat_feature
    • git checkout repeat_feature / git cherry-pick c2^..c5 (from feature)
    • (i got no conflicts)
  • tried cherry-pick c5 master_copy, repeat_feature
    • remember repeat_feature started c3 (so, if there conflict, should raised while cherry-picking c2 c5)
    • git checkout master_copy / git cherry-pick repeat_feature_c5

i still got same conflicts!

even if starting same c3 commit (when cloned branch repeat_feature branch) , trying cherry-pick same c3 commit (into master_copy)!

i totally don't point of what's happening , why these empty conflicts prevent me moving feature master branch.

an expert's suggestion needed here.

i finished change approach:

  • i made copy of _feature_branch_ (git checkout feature_branch/git checkout -b copy_feature_branch);
  • i 'compacted' branch commits single one
    • first: come parent commit of branch: git reset <branch_parent_commit>
    • second: re-add changes git add ., , commit git commit
    • finally cherry-picked commit master branch, applying al changes feature_branch 1 commit (as wanted c5, misinterpreting git cherry-pick). git checkout master/git cherry-pick <last-commit-of-copy_feature_branch>)

this way get no conflicts @ all (as expect happen) , i obtain have 1 commit introduces changes (or anyway 'packet' of changes) feature_branch. made copy of feature branch can have while full sequence of wip commits, useful have while (for testing, apply fixes, see history of changes specific feature). instead of deleting branch rename git branch -m <current_name> finished_<current_name> , keep until i'm not sure want delete it.

it not wonderful workflow it's working me, waiting find better way accomplish needs.

unfortunately still cannot explain specific logic causing conflicts when cherry-picking 1 last commit (partial change feature). know doing wrong, don't know how conflict on specific file-parts coming out.


Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -