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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T21:30:32+00:00 2026-06-10T21:30:32+00:00

My branch branch_a has a file (file_a.txt) which should NOT be different from the

  • 0

My branch “branch_a” has a file (file_a.txt) which should NOT be different from the like-named file on “master”. I’d like to alter the branch in such a way that this changed file is removed from the branch, that is, so that the unchanged file from “master” is again present, NOT a changed branch of that file. What I’m trying to avoid is having to maintain this file, which should never have been changed.

I thought at first git-reset might be helpful. Then I thought perhaps I should “git-rm” the file, but that will not leave me with the file at all. I need to remove it from the branch, so that it is no longer a different version that that on “master”. What is the best practice in this situation?

  • 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-10T21:30:34+00:00Added an answer on June 10, 2026 at 9:30 pm

    I assume you just need to reset that file back to the version on master, not erase any history of changes, correct? The former is easy, the latter requires history modification and should not be done lightly (especially if you’ve pushed the branch outside of your local repo).

    To reset the contents of file foo/bar/baz.txt back to the state it has on master, just check out your branch and run

    git checkout master -- foo/bar/baz.txt
    

    This will grab the file from master, write it into your working copy, and stage it in the index. You can now just git commit that and your file will now match the one on master.

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

Sidebar

Related Questions

master branch has these files and folders (simplified): C:\Local\TickZoom\Project>ls file.txt name.txt public public branch
I have a file in my master git branch called 'Readme.' The file has
I have a file, foo.txt Create and checkout branch 'branch_A' git mv foo.txt bar.txt
Here's what I'm doing. My master branch has a bug in it and I
my co-worker has just create a new branch in the git repository which we
I am trying to move a single file (call it foo.txt) from one repository
Until yesterday my project has only a branch with a .gitignore file similar to:
Our project has a trunk. I worked on Branch A, adding several features, and
Say I have a project in a git repository. The project has a branch
My origin has a fixes and a fixes_v3 branch. My client has just fixes

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.