$ ls -A
$ git init
Initialized empty Git repository in /home/add/reproattempt/.git/
$ echo -e 'one\ntwo\nthree' | tee alpha | tee beta
one
two
three
$ git add alpha beta
$ git commit -m 'Initial commit'
[master (root-commit) e3f1056] Initial commit
2 files changed, 6 insertions(+), 0 deletions(-)
create mode 100644 alpha
create mode 100644 beta
$ git branch branch
$ git branch
branch
* master
$ git rm alpha
rm 'alpha'
$ git commit -m 'Deleted alpha'
[master 5592048] Deleted alpha
1 files changed, 0 insertions(+), 3 deletions(-)
delete mode 100644 alpha
$ git checkout branch
Switched to branch 'branch'
$ sed -i '/two/d' alpha
$ cat alpha
one
three
$ git commit -m 'Edit alpha' -- alpha
[branch cda6327] Edit alpha
1 files changed, 0 insertions(+), 1 deletions(-)
$ git merge master
CONFLICT (modify/delete): alpha deleted in master and modified in HEAD. Version HEAD of alpha left in tree.
Automatic merge failed; fix conflicts and then commit the result.
$ git status
# On branch branch
# Unmerged paths:
# (use "git add/rm <file>..." as appropriate to mark resolution)
#
# deleted by them: alpha
#
no changes added to commit (use "git add" and/or "git commit -a")
$ git delete alpha
git: 'delete' is not a git command. See 'git --help'.
$ git rm alpha
alpha: needs merge
rm 'alpha'
$ git status
# On branch branch
# Changes to be committed:
#
# deleted: alpha
#
$ git commit #Deleted the bits from the editor, but I just used the default message
[branch 0fba33b] Merge branch 'master' into branch
$ git branch branch2
$ git log --graph --decorate --all
* commit 0fba33bbc2e995de7159cedcd04e86869f27c6cd (HEAD, branch2, branch)
|\ Merge: cda6327 5592048
| | Author: me_and
| | Date: Thu Aug 16 11:16:24 2012 +0100
| |
| | Merge branch 'master' into branch
| |
| | Conflicts:
| | alpha
| |
| * commit 5592048e7089cba2c2a88e05bf0b82a8de7e82e6 (master)
| | Author: me_and
| | Date: Thu Aug 16 11:13:25 2012 +0100
| |
| | Deleted alpha
| |
* | commit cda632752e266026a66f8f8433597e83e1d80e2b
|/ Author: me_and
| Date: Thu Aug 16 11:13:57 2012 +0100
|
| Edit alpha
|
* commit e3f10566160bc81587833ea1e026f3e16f4d151a
Author: me_and
Date: Thu Aug 16 11:12:55 2012 +0100
Initial commit
$ git branch
* branch
branch2
master
$ git rebase master
First, rewinding head to replay your work on top of it...
Applying: Edit alpha
Using index info to reconstruct a base tree...
Falling back to patching base and 3-way merge...
Auto-merging beta
$ # Wait, what!? We're merging *beta*? That didn't change!
$ ls
beta
$ cat beta
one
three
$ git checkout branch2
Switched to branch 'branch2'
$ git rebase -i master # Use the default message. That is "pick cda6327 Edit alpha"
error: could not apply cda6327... Edit alpha
When you have resolved this problem run "git rebase --continue".
If you would prefer to skip this patch, instead run "git rebase --skip".
To check out the original branch and stop rebasing run "git rebase --abort".
Could not apply cda6327... Edit alpha
$ # Now that's more like what I'd expect!
$ git status
# Not currently on any branch.
# Unmerged paths:
# (use "git reset HEAD <file>..." to unstage)
# (use "git add/rm <file>..." as appropriate to mark resolution)
#
# deleted by us: alpha
#
no changes added to commit (use "git add" and/or "git commit -a")
$ git rm alpha
alpha: needs merge
rm 'alpha'
$ git rebase --continue
Successfully rebased and updated refs/heads/branch2.
$ ls
beta
$ cat beta
one
two
three