How to merge the branch with no changes into master branch in git?
<p>Having a basic doubt in git branching and merge .
Can a branch be merged without any changes into master . If so , What happens to the delta changes that exists between master and branch . Will that be overridden with master branch changes . Refer the below scenario :</p>
<p>I have two branches master and BugBranch.</p>
<p>STEP 1:</p>
<pre><code>C--B--A   (master)
      |
      X   (branch)
</code></pre>
<p>Took a branch from master say BugBranch .
Now I have a file TestMerge.java.</p>
<pre><code>public static void main(String[] args){
...
...
callSomeMethod();
  switch(decision)
  {
    case A:
        do_something
        break;
    case B:
        do_something
        break;
  }
}
</code></pre>
<p>So at STEP 1 , both master and BugBranch looks same.</p>
<p>STEP 2:
The file(TestMerge) is changed in master as below . ( just removed the switch )</p>
<pre><code>public static void main(String[] args){
...
...
callSomeMethod();
}

C--B--A--1  (master)
      |
      X     (branch)
</code></pre>
<p>STEP 3:
The problem is when I try to merge the branch with the master . Expecting a merge conflict in file , since there exists a delta for sure and want to preserve the changes in BugBranch . But the strange thing is that , its getting overridden with the master changes .</p>
<p>Tried out the below commands</p>
<blockquote>
<p>git checkout master</p>
<p>git merge BugBranch</p>
</blockquote>
<p>This is really confusing !</p>