This happens all the time at work, that someone accidentally commits something to take possession of the function instead of the assigned branch, then the person tries to resolve it, only so that the changes suddenly disappear. I was looking fat and thin, and I can not find any documentation to shed light on why this is happening, or how to fix the situation.
Here are the steps to play:
$ git init
$ echo hello world > testfile
$ git add testfile
$ git commit -m 'init'
$ git branch A
$ echo abc >> testfile
$ git commit -am 'append abc'
$ git revert HEAD --no-edit
$ git checkout A
$ echo fff > secondfile
$ git add secondfile
$ git commit -m 'Add second file'
$ git cherry-pick master^
At this point, the git story is as follows:
$ git log --oneline --all --graph --decorate
* ac6f9b4 (HEAD -> A) append abc
* 54be952 Add second file
| * 9ba1f16 (master) Revert "append abc"
| * ef7c8d6 append abc
|/
* 65a885d init
See what happens when I reinstall branch A on top of the wizard:
$ git rebase master
$ git log --oneline --all --graph --decorate
* 9d08739 (HEAD -> A) Add second file
* 9ba1f16 (master) Revert "append abc"
* ef7c8d6 append abc
* 65a885d init
What happened to the commit that was in chapter A, commit ac6f9b4? Where did he go? why was it not reapplied?
, , : (