Symbol white

← Back to other Codebase suggestions

Strip commits

F8be864967a12d6a8f162eb40d869311?rating=pg&size=52&default=mm
suggested by Daniel M
5

Sometimes a commit makes it into Codebase that shouldn't have ended there. The current procedure is kinda annoying:
Delete the whole repository
Either recreate it under another name or wait until the deletion has made it around your server farm which can take some time.
It'd be much easier, if we could just strip that one commit off the repository online (like Bitbucket lets you). When this problem occurs, you often don't have the time to wait, but creating a differently named repo and telling all your co-workers about it isn't any better.

Collecting We're collecting votes & feedback about this suggestion!

Comments (7)

  • ...and i've posted in the wrong place, of course. Sorry.

    F8be864967a12d6a8f162eb40d869311?rating=pg&size=52&default=mm
    posted by Daniel M
  • Another way to remove a commit is to reset back to a commit before that and do a git push --force. This will remove any new commits that have been since that commit though so watch out.

    C46902e6723e0aa27cf8ff51919a7fff?rating=pg&size=52&default=mm
    posted by Dean P
  • I use Mercurial, does that work there as well? I think I've tried it before but to no avail.

    F8be864967a12d6a8f162eb40d869311?rating=pg&size=52&default=mm
    posted by Daniel M
  • Ah right, nope, the command I posted is for git. Not sure about Mercurial as I've never used it but I would imagine it has a similar command

    C46902e6723e0aa27cf8ff51919a7fff?rating=pg&size=52&default=mm
    posted by Dean P
  • I tried stripping them locally and force-push the changes, but it didn't remove the commits online.

    F8be864967a12d6a8f162eb40d869311?rating=pg&size=52&default=mm
    posted by Daniel M
  • theres no appropriate method for this in normal git realistically you have to remember that these Version Control Systems are made to actually be totally decentralised - the fact that we have a central location in codebase is purely for use as a point of reference - the system doesnt require it to operate
     
    quite simply the correct procedure in your scenario is to correctly revert the commit in a new commit and push it up to codebase and get your servers to pull it all properly
     
    deleting repo's is just a time intensive workaround that isn't the correct way of doing things in reality, stripping a commit off the top is just like undo which you shouldn't rely on particularly in repos where multiple users will be working on the repo because it will lead to inconsistencies quickly and dev's likely end up needing to reclone repo's to carry on again in extreme cases and its not really supported by the version control systems themselves

    3b43c1b209ebdbf195d1829943c207ba?rating=pg&size=52&default=mm
    posted by Anthony S
  • Yes, and then reality happens and someone adds a file that should have never been added (config with passwords), or removes a crucial file (.hgtags).
     
    I do backout (that's how it's called in hg land) commits when there's just some code changes to revert. It's about those other problems though and they happen more often then i'd like.

    F8be864967a12d6a8f162eb40d869311?rating=pg&size=52&default=mm
    posted by Daniel M

Login to comment on this suggestion