Looking at the following git history:
[0][~/Projects/openslate/thing(env/dev-auth:feb0ee9)]
$ git log
commit feb0ee98c8b77e929b9cc23442c5664c9d4986c9 (HEAD -> env/dev-auth) # this is `3.` in the command below
Author: Roberto Aguilar <[email protected]>
Date: Thu Sep 26 00:25:15 2019 -0400
Accidental commit 3
commit 7592d4d1ab1a101ad654abc097672ab9bfecbd8a
Author: Roberto Aguilar <[email protected]>
Date: Thu Sep 26 00:24:50 2019 -0400
Accidental commit 2
commit 89fe221406158f5d069cbd669feddff28e307b4f
Author: Roberto Aguilar <[email protected]>
Date: Thu Sep 26 00:24:08 2019 -0400
Accidental commit 1
commit 58f4606f37359829c5b4f945a1a4c4a17c4428b4 (origin/env/dev-auth) # this is `2.` in the command below
Merge: df3ebc5 3fee1eb
Author: Roberto Aguilar <[email protected]>
Date: Thu Sep 26 00:01:42 2019 -0400
The commit that accidental commits were commited on top of
[...]
There are a few commits that were accidentally made on top of env/dev-auth that should have been made on
a feature branch named experiments/sso-login-app (1. in the command below). In order to fix the
problem git rebase —onto can be used, but it’s confusing. Here’s what the parameters mean:
$ git rebase --onto experiments/sso-login-app origin/env/dev-auth env/dev-auth
\_______________________/ \_________________/ \__________/
| | |
1. the branch that will contain | | |
the final resulting rebase -----+ | |
| |
2. the branch/commit that additional commits were | |
accidentally made on top of --------------------------+ |
|
3. the local branch containing the accidental commits -----------------+