Frerich Raabe
Frerich Raabe

Reputation: 94539

How do you avoid that people forget to run 'git push'?

While evaluating the advantages and disadvantages of moving our Subversion-based repository over to Git, one interesting question came up.

Even though that we're all quite fond of Git, it might happen that some developer (or a team of developers) forgets to push a feature/bugfix onto the repository from which the packages are built.

I'm sure this concern was raised in other software development teams already, I wondered how you tackled this problem.

Upvotes: 8

Views: 1501

Answers (4)

danjarvis
danjarvis

Reputation: 10190

Make a single person (project lead) in charge of pulling from other devs.

Upvotes: 3

Cascabel
Cascabel

Reputation: 497652

I agree that ideally you can fix this simply by trying to give plenty of reminders. A few miscellaneous thoughts:

  • Anything that reinforces the distributed version control idea will help make people think of this more naturally. For example, I favor a workflow that includes using local topic branches and amending/rebasing commits until they're exactly what I want. If you teach how to do this, it becomes obvious that these are things done in your own area. As developers become more aware that their repo is different from the central one, remembering to push will get much easier.

  • If you're on your master branch (or any other branch that tracks a branch on origin), git-status will give you reminders like "Your branch is ahead of 'origin/master' by 1 commit." You'll also see this when you check out master.

  • You could, if you really wanted, write a post-commit hook that simply notifies the user how far they've diverged from origin. There are a lot of ways to approach this, depending on your workflow - perhaps just duplicate that status message, perhaps find the oldest commit on the current branch that isn't in origin so you can let them know how long it's been... Note that including hooks with the repository isn't trivial: .git/hooks is not tracked, so you have to symlink either the directory or the hooks inside it into the repo. This can be automated by a setup script, though, so it's not too bad!

Upvotes: 7

Ball
Ball

Reputation: 2601

While there are technical solutions, this is truly a social problem. I'd start by talking with the developers and explain to them they are essentially running in isolation from the rest of the project. This isolation is a risk to the project. Remember, this probably isn't willful ignorance. They just forget that a commit isn't going to the central svn server anymore.

Upvotes: 2

retracile
retracile

Reputation: 12339

The same way you deal with people who work for a week in their local svn working copy without committing.

It's the same exact issue.

Upvotes: 6

Related Questions