Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Collaborator guide: force pushing #1355

Closed
jbergstroem opened this issue Apr 6, 2015 · 8 comments
Closed

Collaborator guide: force pushing #1355

jbergstroem opened this issue Apr 6, 2015 · 8 comments
Labels
discuss Issues opened for discussions and feedbacks. meta Issues and PRs related to the general management of the project.

Comments

@jbergstroem
Copy link
Member

There's been a few questions about force pushing. We should talk it out and add guidelines to our collaborator guide. To be honest, I think we should disallow it unless the tree is in a serious mess. It's error prone, often made in haste and since the git userbase of io.js is growing some people will get the sour apple. One approach to lessen the amount of mistakes is to have a pre-commit hook. Initially, we should focus on the commit message. Lengths, typos, verify email/user of reviewed-by. Perhaps even PR.

Until that happens; how about (this only applies to public branches): You're only allowed to force push within 10 minutes of your commit unless someone else has committed ahead of you.

@bnoordhuis
Copy link
Member

how about (this only applies to public branches): You're only allowed to force push within 10 minutes of your commit unless someone else has committed ahead of you.

We used to have an unofficial '5 minutes' rule so that sounds fine to me.

@tellnes
Copy link
Contributor

tellnes commented Apr 6, 2015

I agree with that the commit you want to amend must be at the top of the branch your are force pushing to, but I think the window could be bigger than 10 minutes. If you need to force push and first sees that after 10 minutes, I think it should be ok to do so as long as you are within the other rules.

Also, the guidelines should includes some notes about being explicit and git configuration. I have done some harm in the past by running git push -f with the intention of only force pushing the current branch, but force pushed all remote tracking branches.

@jbergstroem
Copy link
Member Author

@tellnes If someone else pulls within the scope between your first and second (-f) push, you will be giving them a bad day -- and even worse: a inconsistent repo they are adding their changes to. Imagine someone force pushing while someone is doing a release, which is then tagged (we don't do git tag -a just yet afaik) and pushed.

Regarding just pushing to current branch -- that's a good point. I think the default changed in from pushing all to just one in git 2.0 which means you will have to enable this manually. Adding a lowest git version for collaborators would probably be a good idea as well.

Edit: This is why always working in branches is such a good practise. It gives you the freedom to treat it as your own, commits, squashes and force pushes at your service. We should just have tooling in place that lessens the amount of scenarios for forced pushes.

@tellnes
Copy link
Contributor

tellnes commented Apr 6, 2015

Yeah, I now I will be giving them a bad day. But that holds true even if you force push after 1 minute. There is still a window. I'm just saying something like 30-60 minutes. If we allows force pushes at all, we should document it in the Readme and document how to fix the repo if someone is pulling in the window (git pull --rebase).

If someone is doing a release and creates bad release commits, they should get an error when they tries to push those commits. That should stop someone from creating a bad release, but it still gives them a bad day and extra work. Maybe we should have a rule against force pushing while someone is doing a release? The collaborators are probably monitoring the release issue anyway.

I understand people probably wont agree with me on extending the window, but I'm just making my points.

Regarding just pushing to current branch: Yes, I believe it was changed in git 2.0 also.

@mscdex mscdex added meta Issues and PRs related to the general management of the project. discuss Issues opened for discussions and feedbacks. labels Apr 6, 2015
@Fishrock123
Copy link
Contributor

Maybe we should have a rule against force pushing while someone is doing a release?

Might be good, but the release won't work unless the (manually triggered) CI build afterwards pulls up the correct tag, so even if the commits did briefly get overwritten, it wouldn't actually be catastrophic.

.. actually, on second thought, you might just build from an orphaned tag then, which would be bad. But you'd definitely have enough time to notice.

@silverwind
Copy link
Contributor

+1 for a pre-commit hook that checks the commit message. Should write it in JS. 😆

@Fishrock123
Copy link
Contributor

@silverwind actually, that is a really good idea.

@Fishrock123
Copy link
Contributor

Fixed in 76f219c

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
discuss Issues opened for discussions and feedbacks. meta Issues and PRs related to the general management of the project.
Projects
None yet
Development

No branches or pull requests

6 participants