Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6702867
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T07:06:14+00:00 2026-05-26T07:06:14+00:00

I am using a script to automatically checkout the first commit of each month,

  • 0

I am using a script to automatically checkout the first commit of each month, for the last 12 months. Occasionally something strange happens and I am no longer allowed to checkout past commits. The error goes something like this:

error: Your local changes to the following files wold be overwritten by checkout:

db tests/framework.cpp

Please, commit your changes or stash them before you can switch branches. Aborting

This has happened many times (I am not editing any files, just checking them out). I usually just download a fresh copy of the repo from Github and start the process again and it works. But once it breaks I don’t know how to fix it, and it keeps happening. Any thoughts?

Here is the iteration going on in my script, followed by the output of git status

for i in {12..1}

do

cd
cd git/mongodb/mongo

git checkout master                   
git checkout $(git rev-list --before "$(date -d "$(date +%Y-%m-01) -$i months 00:01" +%Y-%m)-01" -n 1 HEAD)
git checkout master

Git status:

On branch master

Changes not staged for commit:

        modified:    dbtests/framework.cpp

Untracked files:

       SHA1.txt
       SHA1.txt.
       file
       file.

no changes added to commit

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T07:06:14+00:00Added an answer on May 26, 2026 at 7:06 am

    You can use the --force flag to make Git do the checkout anyway.

    Alternatively, you could use git reset --hard instead to reset to the commits, rather than using checkout.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Background: I'm trying to write a shell script using php that will automatically checkout
I wrote a script using Ruby to click on the screen automatically on Windows's
I made a custom ant script to automatically create a jar file each time
I am writing a script using boto and Python to automatically launch an Amazon
I am using the following script to adjust the iframe height automatically. function autoIframe(frameId)
I'm using a script to create a new Invoice record. I'd like to automatically
Im trying to automatically run a script using Cygwin via CMD. I basically created
I am using a Batch script to automatically backup files to my NAS and
how to refresh the asp.net Label every second automatically using Java script instead ajax?
I create backups using the same .bak file. I've made a script to automagically

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.