0

While merging into the master branch it merges files that are already merged in master via different branch

Master branch M Feature branch f1,f2,f3

M <-f1
M<-f2
M<-f3

git clone http://test.com/test.git git checkout M

Open file in PHPstorm .It asked to Open project .clicked on confirm

git checkout -b f1
git status 
# it shows all file as modified even only file1 is updated

Open desired file file1 did the modification and saved it

git commit file1 -m 'f1 branch' 
git push -upstream f1
 git checkout M 
git merge f1 

git log -1 --stat

shows only 1 file file1 it merges file1 git push. The process is done properly but when tried same with branch f2. it merges file1 and file2 same goes for push where I am going wrong. But on each merge in master, it pushes previous branches files

Step where actual issue Occurs

git checkout -b f2

Open file2 in phpstorm modify and save the file

git status  

All files are shown as modified whereas only file2 was actually updated

git commit file2 -m 'test for f2'
git push -upstream f2
#push only file 2
git checkout M
git status
o/p Your branch M
your branch is ahead of 2 commits
git merge f2
#it merges file1 and file2
git push
#it pushes file1 and file2 

My 2 questions:

  1. How to open the project that is under git repository via PHPstorm. Is it the main cause to show all files as modified
  2. What wrong i am doing in merge or is there any method to just merge few files and push only few files in main branch.

Had taken reference from How can I merge two branches without losing any files?

Have updated the question is it clear

0 Answers0