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 7957789
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T04:18:49+00:00 2026-06-04T04:18:49+00:00

I created a repository on github. My initial repository content are as follows: D:\github\Learn-PyQt>dir

  • 0

I created a repository on github. My initial repository content are as follows:

D:\github\Learn-PyQt>dir
Calculate.py
Connections.py
CurrencyCalculator.py
ImprovedSignals.py

All the above files are up-to-date in respect to my remote git repository. What I mean is I have successfully executed git add, git commit, git push on my repository.

Now after the above procedure by mistake I deleted the file Connections.py from my system (localmachine). After deletion I have not yet pushed anything.

Now, as the file is present on my github repository is there any way I can execute a command and update the contents of my local directory mentioned above.

I know that one can delete the current repository and do a git clone but I don’t want to download all the files from my repository. Just the one that is deleted. So, something like git sync currentdirectory.

  • 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-06-04T04:18:50+00:00Added an answer on June 4, 2026 at 4:18 am

    Simply

    git checkout -- Connections.py
    

    You will get back the content of that file as last pushed or last added to the index (minus any local modification you might have done since said last push).

    In short, git checkout can be used for a file or a path, not just a full tree like a commit or a tag.

    If you had made several commits before realizing that your file was deleted, then you would have had to apply one of the solutions of “Restore a deleted file in a Git repo“.

    I particularly like, for a directory where some files are missing:

     git ls-files -d | xargs git checkout --
    

    (git ls-files -d would show deleted files)

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

Sidebar

Related Questions

I created an original GitHub repository and committed all my code. I would like
Here are the steps I took. I created a repository on github and generated
I've created git repository, added code and pushed it to GitHub. Then locally, I've
I'm new to Git and Github. I created a repository but am unable to
I'm working with a friend using github and eclipse. Initially he created the repository
I have main repository at github. I have created a fork. I created a
I created a new repository in Github to share my vimfiles. But there's some
I am very new to GitHub. I have created a GitHub repository and pushed
My problem is with using github and Egit. Egit fetched all of my repository
So: 1) I have created my account on github and I've created a repository

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.