Solar wrote:
Maybe we have a disconnect in vocabulary here.
What, in your workflow, makes something -- like a branch -- "private"?
I'd like to draw the line at remote / local. If it's in the remote (main) repository, it's publically visible, and any modification there is "rewriting history".
Have I overlooked some kind of privacy feature?
Let me try to explain. Let's say you own a project called PROJ somewhere, using GIT. I cannot or I'm not supposed to directly push any commits there directly. So, I could just clone it on my machine and work there on a local branch. But, what if I my machine dies or what if I would like to access my work from multiple machines? Well, I'll make a fork of your whole PROJ in my (remote) account. Then, I'd push my work on the FEATURE_XYZ branch on the remote machine. My fork can be private or public, that doesn't matter: what matter is that nobody knows about my fork and nobody cares. Everybody continues to clone your PUBLIC/OFFICIAL repository when preparing for changes.
So, I continue to work on my series of commits, synching everything up with the remote machine until, after passing a review, my patch series is ready. At that point, I can:
- Create a pull request, asking you to pull the commit in my private branch into the official repo of PROJ. In case my changes don't merge directly, you might ask me to rebase my feature branch to the latest commit in master and then update the pull request.
OR
- Given the permission to push directly into your PUBLIC/OFFICIAL repo, I checkout the latest version locally and merge my feature branch on the master branch of my local copy of PROJ. During that, I might have to resolve conflicts. After testing that everything works, I push my new master into the official repo.
So, even if I had the permission to push commits to the PUBLIC/OFFICIAL repo, I don't do it until my code is ready and has been reviewed. I certainly won't create a branch on my own in the official repo. The whole point of GIT is that everybody works on his/her own fork of the official repo and then pushes (or makes a pull request) to the official repo once the series is ready.
In conclusion it's not considered "rewriting history" when it's about a private fork, because nobody cares about that history other than the developer himself. Typically people cannot even see that private/temporary repo, because it's in the home directory of the developer and he/she syncs with that via SCP (through git). Everybody cares about the history of the official repo and in *no case* the history there should be re-written.