Is there any way to remove a couple of commits from a branch only if a different branch refers to the commits?
For example, if I did the following commits:
ABC-1: Add views for feature ABC-1
ABC-1: Add controller action for feature ABC-1
and then I discovered that I did them on the develop
branch, rather than on feature/ABC-1
, I'd do
git checkout -b feature/ABC-1
git checkout develop
git reset --hard HEAD~~
is there any options I can pass to git reset that'll refuse to do the git reset if I hadn't created the feature/ABC-1
branch? Kind of like how git branch -d
only deletes a branch if it refers to commits that are included in the branch you're currently on?
I could do
git checkout -b feature/ABC-1
git branch -d develop
git checkout HEAD~~
git checkout -b develop
but that loses information about which remote branch develop
is tracking.