I wanted to understand how Git handles the following situation in the Feature Branch Workflow: On the master branch a file is deleted and then that delete is committed. On a feature branch the same file is deleted and that delete is committed. Then the master branch is rebased over the feature branch.
[user@host public]$ git status # On branch master nothing to commit (working directory clean) [user@host public]$ git checkout -b master_test Switched to a new branch 'master_test' [user@host public]$ git checkout master Switched to branch 'master' [user@host public]$ git rm test.txt rm 'public/test.txt' [user@host public]$ git commit -m "Remove test file" [master 0cfee96] Remove test file 0 files changed, 0 insertions(+), 0 deletions(-) delete mode 100644 public/test.txt [user@host public]$ git checkout master_test Switched to branch 'master_test' [user@host public]$ git rm test.txt rm 'public/test.txt' [user@host public]$ git commit -m "Remove test file on the feature branch" [master_test f6468dc] Remove test file on the feature branch 0 files changed, 0 insertions(+), 0 deletions(-) delete mode 100644 public/test.txt [user@host public]$ git checkout master Switched to branch 'master' Your branch is ahead of 'origin/master' by 1 commit. [user@host public]$ git rebase master master_test First, rewinding head to replay your work on top of it... Nothing to do. [user@host public]$ git log -1 commit 0cfee962f7cab143d7a2835e0ecd50d8cef7230e Author: leonard <[email protected]> Date: Mon Nov 9 10:47:28 2015 +0000 Remove test file [user@host public]$ git branch master * master_test Is Git happy to discard the Remove test file on the feature branch commit because it sees it as being the same? Will it always override the feature branch commit with the one from master (when rebasing this way) and would the same thing happen when combined with multiple commits?