Wednesday, February 7, 2018

multiple commits in a PR




I ended up with multiple commits in my PR after a rebase (and followup push) in my "working" branch.


Solution:

I first copied those few files which I have modified/ added into a temp directory (along with entire path).

then reset my branch with origin/master.

git reset --hard origin/master

So, now the "working" branch is in sync with master branch.



Now, copy back all those files from temp directory into the "working" branch.

Carried out a fresh commit with all changes and verified all changes looks fine.


Then, just did a force push as :

git push --force

Now, you can check in github whether only one commit with required changes present.

Lesson:
Always verify git status before a push especially after a rebase.

PS: not an optimal solution, but manual way.

No comments:

Post a Comment