I have a repo (bitbucket.org/mine/project) which I forked from another repo (client.com/theirs/project). I made a bunch of commits to mine and now I want to push it back to their repo. I know I can push it to the upstream repo but it seems to include all the commits. My current workaround is I have both projects cloned and copying files from my repo working dir to their repo working dir and committing. Definitely not ideal. How do I squash my commits to a single commit when I push but leave my history intact?
Attempt to illustrate the issue:
Client ---- forked ------> Bitbucket their/project mine/project commit #A commit #A commit #B commit #B commit #C commit #C |- commit #1 | commit #2 | commit #3 commit #D <----- how? ------ |- commit #4 // I want to keep my commits
The owner of the
their/project Github repo could always do this for you by choosing to
Squash and Merge the commits from your branch via the Pull Request UI:
Answered By – Adil B