I have a pull request on an Open-Source repository with one commit e.g., commit a
. Now someone requested me to change some code in that commit.
If I open that branch in my Android Studio and change the requested code and then If I commit again, there will be two commits. I want to change the code and only have one commit in my pull request.
Things I have tried:
I tried resetting the HEAD to initial commit by git reset HEAD~2 --soft
and then git commit -a -m "combined commit message"
but then when I am pushing this branch to my remote repository then a pop-up appears which says "This branch has conflicts with the remote branch which need to be resolved"
with options merge
and rebase
. I know what that means. It's because I am changing the same code which is there in my remote branch. So I want to rebase
. Then there is a received commit a
. Then I again run git reset HEAD~2 --soft
and again git commit -a -m "I have received the commit and I am combining these two commits again"
but when I again push it, the same pop up appears.
Any help? How to change the same code and still have one commit in that pull request?