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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T18:47:56+00:00 2026-06-15T18:47:56+00:00

I have a .htaccess file with specific settings inside it that only work for

  • 0

I have a .htaccess file with specific settings inside it that only work for my machine.

When I pull in changes from another persons branch I always have to undo the changes made.

I think I can do git checkout file hash to get the original file back (is that correct? If not can someone show me the correct command) but is there not a way I can tell Git to track the file on my branches but to never pull down the file from another remote branch?

On a similar note: how can you have git track a particular file but never push it to a remote branch. Eg I have a file with password details inside it but if I’m storing my file publicly on GitHub then I don’t want that file pushed up.

Thanks

  • 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-15T18:47:57+00:00Added an answer on June 15, 2026 at 6:47 pm

    The command to restore the file to what it had been in a previous version is actually

    git checkout commit file
    

    With the arguments in the opposite order of what was in the question. The commit can either be a hash or any other way of referring to a commit such as a branch or tag name.

    You could setup git to automatically keep your version of the .htaccess file by specifying a custom merge driver.

    To do this, first you’d need to define the merge driver in the git config, and then specify that that merge file should be used for the .htaccess file.

    git config merge.mine.driver 'touch %A'
    echo .htaccess merge=mine >> .gitattributes
    

    But, this would not be a good idea if your local branch will ever be merged into the branch from which you’re pulling changes. This would be recording that changes to that file have been merged even though they’re actually being completely ignored. So if your branch were merged back into the other branch all changes to that file would likely be reverted.

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

Sidebar

Related Questions

Ok, so I have this .htaccess file that contains this <IfModule mod_rewrite.c> RewriteEngine On
So I have the following .htaccess file contents from my other project which is
I have a .htaccess file set up to define specific MIME types in directory
We have need for creative htaccess file: when user enters file that exists -
I have a specific file, let's call it 'myfile.abc', that I need to have
I have the following .htaccess file: Order deny,allow Deny from all Allow from XX.XXX.XXX.XXX
I have been here: How to exclude a specific file in htaccess and here:
I'm trying to set up a htaccess file that would accomplish the following: Only
I have an htaccess file that uses mod_rewrite to redirect /controller to /index.php?controller=%controller% Like
I have such .htaccess file: RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME}\.php

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.