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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T01:20:50+00:00 2026-05-17T01:20:50+00:00

I have a file named myfile.php on my server and in my computer. I

  • 0

I have a file named “myfile.php” on my server and in my computer.
I want to remove myfile.php from git index in order to prevent changing myfile.php in server.I do this by adding the file to .gitignore and removing the file from index with “git rm –chached myfile.php”
Now when I run “git pull” it removes the file itself from working directory in server but I want to keep it on the server and just keeping it safe from changing.
What’s the problem?

  • 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-17T01:20:50+00:00Added an answer on May 17, 2026 at 1:20 am

    If you accidentally added to the index a file you want to remove from the index (but not delete from git’s history) then use:

    git reset HEAD <file>
    

    Also, you can note that when you execute git status, git will actually tell you this:

    $ git status
    # On branch master
    # Changes to be committed:
    #   (use "git reset HEAD <file>..." to unstage)
    #
    #       modified:   my_file
    #
    $
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Say you have a file myfile.php which executes some PHP code. Could this file
I am retrieving json from a php file that connects to the database and
How can I edit a javascript file using php. I want to change the
I'm writing an API and I'm wanting to handle file uploads from a form
I have an external JavaScript file and whether in FireFox or Chrome, whether all
Right now, when I notice a problem on a page on my PHP web
I'm setting up an ASP Classic website on Win7 x64, I have done the
I have a form in my HTML with field. I'd like to show the
I have a data that looks like this -- read50_1: read1391364_2,read3529226_1, -- read46_2: read916_1,read178252_2,read1336397_1,read1824459_2,
I am planning to use jQuery UI Autosuggest for a search form. So I

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.