git - How to merge deleted files from another branch? -


i've learned how merge specific files branch this link. however, post not work merging deleted files. i've created git repository simulate situation, may try this. here example,

$git clone https://github.com/gtchoi/so_question.git $git branch --track test origin/test $git checkout test $git checkout master -- . $git status  on branch test branch up-to-date 'origin/test'. changes committed:   (use "git reset head <file>..." unstage)      new file:   a.html $ls a.html      b.html      index.html 

as , expected (please see the repository), compared current branch (test), a.html must added working tree, git manages a.html master branch, b.html still in working tree. i'd have b.html removed working tree since b.html deleted master branch. how can merge deleted files branch?

the problem seems b got added test branch independently master branch

enter image description here

if want make test identical master use e.g.

$ git reset --soft master  $ git status on branch test branch , 'origin/test' have diverged, , have 3 , 1 different commit each, respectively.   (use "git pull" merge remote branch yours)  changes committed:   (use "git reset head <file>..." unstage)          deleted:    a.html         new file:   b.html  $ git commit -am 'made identical master branch' [test 56ab8cb] made identical master branch  2 files changed, 1 insertion(+), 1 deletion(-)  delete mode 100644 a.html  create mode 100644 b.html 

Comments

Popular posts from this blog

android - Pass an Serializable object in AIDL -

How to provide Authorization & Authentication using Asp.net, C#? -

How to use Authorization & Authentication in Asp.net, C#? -