git - How to to selectively edit and accept changes committed in another branch without editing hunks? -


i trying select/edit changes branch before merging - e.g., after fetch.

when there conflicts, easy go conflicted file , remove/edit text between '>>>' , '<<<'. when there no conflict seems usual way edit hunks have found in answers answer1, answer2:

git checkout -p  

or

git add -p 

however, despite simplicity of hunk editing, single (after splitting) long hunk not practical correctly edited. suppose difficulty comes when number of lines changes or ' ' lines unwittingly removed or transformed '+' lines. problem, maybe more important, whole file not available. there text gaps between hunks otherwise make editing more comfortable.

one solution think of simulate changes conflicts. possible? answer suggests complex sequence of commands comment suggesting equally complex (to used @ git root) alias:

git config --global alias.remerge '!sh -c "git show head:${2} > ${2}.head; git show ${1}:${2} > ${2}.${1}; git show $(git merge-base head ${1}):${2} > ${2}; $(git config --get merge.tool) ${2}.head ${2} ${2}.${1};"' 

another answer same question presents least confusing solution check out other branch in different working copy, weirdly remembers me of svn remote past.

none of solutions seems adequate performed on routinely basis.

[an example of scenario when receive code or text files supposed perform approximate contributions, need corrections regularly. more concrete case software spec or code or scientific paper being fetched software architect or supervisor after his/her fast-and-dirty review.]


Comments

Popular posts from this blog

php - Zend Framework / Skeleton-Application / Composer install issue -

c# - Better 64-bit byte array hash -

python - PyCharm Type error Message -