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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T08:22:17+00:00 2026-05-16T08:22:17+00:00

Suppose I git clone a repository. Then edit a file A and delete a

  • 0

Suppose I git clone a repository. Then edit a file A and delete a file B. How can I restore my working copy to the original status?

Something similar to svn up.

  • 1 1 Answer
  • 1 View
  • 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-16T08:22:18+00:00Added an answer on May 16, 2026 at 8:22 am
    git reset --hard HEAD
    

    is the command that will fully reset your working directory to what was in the most recent commit of the current branch. Be careful. All the work in your commit before you do the reset will be clobbered, and you’ll lose it.

    If you only need to reset a single file without modifying anything else, git checkout -- fileA.txt will revert only that file (regardless of whether it has been just edited or fully deleted).

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

Sidebar

Related Questions

Suppose I have Git repository like this: git-repo/ directory_1/ directory_2/ directory_3/ This has a
Suppose I have a git repository with several branches. I suspect some of the
Suppose I have a git repos that contains original.script . At some point, I
I am new to git and github. Suppose I have a public github repository,
Suppose I have: alias gg=git grep then stuff like: gg int x works, but
Suppose I have had to use git filter-branch to remove a file from revision
Suppose we have the following repository structure on github: company:project.git \- company:submodule.git A developer
Suppose I changed my file foo.txt and run git add foo.txt . Now foo.txt
Suppose I have the following git commits: aaaaaa bbbbbb cccccc (the latest) I would
Backround: Suppose I have the following Git URLs (hosted on github) http://github.com/mikl/drupal.git git://github.com/mikl/drupal.git (Git

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.