DEV Community

Cover image for Why Do You Push Code During Work Hours?" - How an Interview Question Led Me to Build a Delayed Commit Feature
Huynh Thanh Phuc
Huynh Thanh Phuc

Posted on

Why Do You Push Code During Work Hours?" - How an Interview Question Led Me to Build a Delayed Commit Feature

The Interview That Changed My Perspective

Picture this: I'm sitting in a technical interview, feeling pretty confident about my answers so far. Then the interviewer glances at my GitHub profile and asks a seemingly innocent question:

"I notice you push code mostly during work hours. Can you tell me about your development workflow?"

I froze.

Not because I was doing anything wrong, but because I suddenly realized how much our commit timestamps reveal about our work habits. In that moment, I understood that my GitHub contribution graph wasn't just showing my coding activity—it was inadvertently broadcasting my work schedule to the world.

This interview question got me thinking: What if developers want more control over when their commits appear to be made?

The Problem We Don't Talk About

As developers, we live in a transparent world. Our GitHub profiles are our resumes, our contribution graphs are our performance metrics, and our commit histories are open books. But here's the uncomfortable truth:

  • Work-life boundaries are blurring: That green square at 2 AM? It might just be because you finally fixed that bug, but it signals "always available" to some employers.
  • Timezone confusion: Working from Asia but applying to European companies? Your commit times might look odd to recruiters.
  • Privacy concerns: Not everyone wants their daily routine visible to the world.
  • Unconscious bias: Some people judge productivity by when commits happen, not what they contain.

After that interview, I decided to do something about it. I built the Delayed Commit feature for GoCommit, my AI-powered commit message generator.

What Is Delayed Commit?

The concept is simple but powerful: prevent commits during your defined work hours and let you schedule them for later.

Here's how it works:

  1. You configure your "restricted hours" (e.g., 9 AM - 5 PM)
  2. When you try to commit during those hours, GoCommit intercepts it
  3. A friendly UI appears, suggesting alternative times
  4. You pick a time (or enter a custom one)
  5. Your commit is created with that timestamp

No scripts, no manual git commands, no fumbling with --date flags. Just a smooth, integrated experience.

The Architecture Behind the Magic

Building this feature was fascinating. Here's what happens under the hood:

1. Time Validation

func isTimeInRestrictedRange(currentTime time.Time, config DelayedCommitConfig) (bool, time.Time, error) {
    hour := currentTime.Hour()

    if hour >= config.RestrictedStartHour && hour < config.RestrictedEndHour {
        // Calculate when restrictions end
        endTime := time.Date(
            currentTime.Year(), currentTime.Month(), currentTime.Day(),
            config.RestrictedEndHour, 0, 0, 0, currentTime.Location(),
        )
        return true, endTime, nil
    }

    return false, time.Time{}, nil
}
Enter fullscreen mode Exit fullscreen mode

2. Smart Time Suggestions

The system generates suggested commit times at configurable intervals (default: 20 minutes) starting from when your restrictions end:

┌──────────────────────────────────────────────────────────┐
│ Commit during work hours (09:00-17:00) detected         │
│ Current time: 14:30                                      │
│                                                          │
│ Select commit time:                                      │
│  → 17:20 (5:20 PM) - Today                              │
│  • 17:40 (5:40 PM) - Today                              │
│  • 18:00 (6:00 PM) - Today                              │
│  • 18:20 (6:20 PM) - Today                              │
│  • Enter custom time...                                  │
│                                                          │
│ ↑↓: Move  Enter: Select  Esc: Use current time anyway   │
└──────────────────────────────────────────────────────────┘
Enter fullscreen mode Exit fullscreen mode

3. Git Integration

Git actually supports custom timestamps natively! The trick is using both the --date flag and the GIT_COMMITTER_DATE environment variable:

func executeDelayedCommit(message string, timestamp time.Time) *exec.Cmd {
    dateStr := timestamp.Format(time.RFC3339)

    cmd := exec.Command("git", "commit", "-m", message, "--date", dateStr)
    cmd.Env = append(os.Environ(),
        fmt.Sprintf("GIT_COMMITTER_DATE=%s", dateStr))

    return cmd
}
Enter fullscreen mode Exit fullscreen mode

This ensures both the author date (when the code was written) and committer date (when the commit was recorded) match your chosen time.

Real-World Use Cases

Since implementing this feature, I've discovered several legitimate use cases:

1. Maintaining Work-Life Boundaries

Developers who want to separate personal projects from work hours without actually changing when they code.

2. Timezone Management

Remote workers who want their contributions to appear during "normal" hours in their employer's timezone.

3. Privacy Protection

Freelancers who don't want clients tracking their exact working hours.

4. Contribution Graph Aesthetics

Let's be honest—some people just want a nicer-looking contribution graph. And that's okay!

5. Retroactive Commits

Sometimes you work on code offline or forget to commit. Being able to set accurate timestamps helps maintain an honest history.

The Ethics Question

Now, I know what you're thinking: "Isn't this... dishonest?"

Let's talk about it.

Here's my take: Git timestamps have always been flexible. You can manually set them, rebase changes, or use any number of tools to modify history. This feature doesn't enable anything new—it just makes an existing capability more accessible and user-friendly.

The real question is: Should your coding schedule be public information?

I argue it shouldn't. Your value as a developer comes from:

  • The quality of your code
  • Your problem-solving skills
  • Your collaboration and communication
  • The impact of your work

Not from whether you pushed at 2 PM or 2 AM.

This tool helps you control your narrative without lying. You're still writing the code, still making the commits—you're just choosing when they appear in your history.

Getting Started

Want to try it? Here's how to set up GoCommit with delayed commits:

1. Install GoCommit

# Linux/macOS
curl -sSL https://raw.githubusercontent.com/thanhphuchuynh/gocommit/main/install.sh | bash

# Or download from releases
# https://github.com/thanhphuchuynh/gocommit/releases
Enter fullscreen mode Exit fullscreen mode

2. Configure Your API Key

GoCommit uses AI to generate commit messages, so you'll need an API key:

gocommit --config
Enter fullscreen mode Exit fullscreen mode

Choose between Google Gemini or OpenRouter (which gives you access to Claude, GPT-4, Llama, and more).

3. Enable Delayed Commits

gocommit --config-delayed
Enter fullscreen mode Exit fullscreen mode

You'll be prompted to set:

  • Restricted start hour (e.g., 9 for 9 AM)
  • Restricted end hour (e.g., 17 for 5 PM)
  • Suggestion interval (e.g., 20 minutes)

4. Use It Naturally

git add .
gocommit
Enter fullscreen mode Exit fullscreen mode

That's it! If you're committing during restricted hours, you'll see the time selection UI. Otherwise, it works exactly like before.

Configuration File

Under the hood, it's just a simple JSON config at ~/.gocommit.json:

{
  "api_key": "your-api-key",
  "logging_enabled": true,
  "icon_mode": false,
  "delayed_commit": {
    "enabled": true,
    "restricted_start_hour": 9,
    "restricted_end_hour": 17,
    "suggestion_interval_min": 20
  }
}
Enter fullscreen mode Exit fullscreen mode

P.S. If you found this useful, give GoCommit a star on GitHub! It helps more developers discover the tool. Also, GoCommit generates your commit messages with AI, so you get both better messages AND schedule control in one tool.


About the Project

GoCommit is an AI-powered commit message generator that:

  • Analyzes your staged changes automatically
  • Generates meaningful, conventional commit messages
  • Supports multiple AI providers (Gemini, Claude, GPT-4, Llama, etc.)
  • Includes built-in logging for prompt improvement
  • Now features delayed commits for schedule control

It's free, open source, and designed to make your Git workflow smoother. Check it out!

Top comments (9)

Collapse
 
emilioacevedodev profile image
Emilio Acevedo

This is a fascinating article. It's a brilliant engineering solution to a problem that is, at its core, 100% cultural.

Your question on ethics is key, but I would reframe it: "Isn't it unethical for a leader or recruiter to use Git timestamps as a proxy for productivity in the first place?"

This is a symptom of a low-trust culture, very similar to the "status report dailies" I discussed in my own article on 'Scrum Zombies'. We're seeing a focus on activity (when you commit) rather than impact (the value you deliver).

As senior engineers and leaders, our real job is two-fold:

  1. Yes, build pragmatic tools like this to protect our teams.
  2. But more importantly, champion a culture where no one even thinks to look at commit timestamps, because they are focused on outcomes.

The tool is fantastic (and a clever use of Go), but the problem it exposes runs much deeper. Thanks for starting this very necessary conversation.

Collapse
 
louis7 profile image
Louis Liu

Good point. This often happens when a manager lacks the ability to improve the team and instead tries to use his power to remind people of his/her presence.

Collapse
 
emilioacevedodev profile image
Emilio Acevedo

Totally agree. It's the manager who, lacking real ways to add value, defaults to "management by presence."

It's the 2024 version of demanding a 100% return-to-office, only to watch us sit at our desks... while on a Teams call with the colleague three meters away.

The goal isn't collaboration; it's "attendance validation" to justify the cost of the office space. 😂

Collapse
 
louis7 profile image
Louis Liu

Interesting, I'm wondering whether it will eat my commits 😜.

It seems like the core concept of this project is commit scheduling, but in the end, you mentioned it is an AI-powered commit message generator. Code editor like VS Code supports auto-generate commit message, so I think it is not a key feature for me😝.

Collapse
 
thanhphuchuynh profile image
Huynh Thanh Phuc

kk thanks. if someone does not use VS Code, maybe this tool will help :D

Collapse
 
p3ngu1nzz profile image
p3nGu1nZz

nice read, but seems over kill when you can do this instead

(sleep 3600 && git push origin main) &
Enter fullscreen mode Exit fullscreen mode

or

echo "Delaying push until 2am…" && at 2am <<< "cd /your/repo && git push origin main"
Enter fullscreen mode Exit fullscreen mode

or perl if your old skool

perl -e 'sleep 3600; system("git push origin main")' &
Enter fullscreen mode Exit fullscreen mode

POSIX scripts are much easier to make interop between projects..

Collapse
 
getsetgopi profile image
GP • Edited

The interviewer's question seems reasonable to me. They wanted to know why you were working on your personal project during official work time, which is a concern for any company. You are demonstrating unethical moonlighting practices to the developer community by creating a tool to bypass commits time.

Collapse
 
xwero profile image
david duymelinck

What a weird way of promoting your project.

You have a problem with people asking why you only push during work hours, and your solution is to let your project create commits during working hours?

Collapse
 
thanhphuchuynh profile image
Huynh Thanh Phuc • Edited

I just shared my tool (just for fun), some time during my working time at the company, during my break time, ... I usually push code, commit something (like the utils components, some ideas, code fix bug of my project, code to test some tools) on my GitHub. That is my routine.
When I was in an interview, some people looked at my GitHub profile and told me I hadn't focus on tasks in my company.