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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T19:14:26+00:00 2026-06-06T19:14:26+00:00

I have a file in my master git branch called ‘Readme.’ The file has

  • 0

I have a file in my master git branch called ‘Readme.’ The file has the following text:

This is the master branch

I made a topic branch called ‘justatest’ and edited the ‘Readme’ file inside of it. I edited this file (while the justatest branch was checked out) to say the following:

This is the master branch
This text should only be seen in the ‘justatest’ branch

When I am in the ‘justatest’ topic branch it appears correctly, but when I switch to the master branch, here’s what the file says:

This is the master branch
This text should only be seen in the ‘justatest’ branch

As you can see, it’s making the changes in the master branch even when I have a topic branch checked out! WHY???

The worst part is that if I don’t like the changes I have made in the topic branch and I delete it, the changes REMAIN in the master branch!! Where’s the safety in that???

  • 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-06T19:14:27+00:00Added an answer on June 6, 2026 at 7:14 pm

    When you make edits, they are not part of any branch. These changes are only in your working folder. Changing branches while you have some outstanding work not yet committed is allowed – as long as they don’t conflict with the committed version of the files.

    In your case it’s even simpler. Since you just made the branch, both master and this new branch point to the same commit. Once you add and commit your changes, switching branches will have the behaviour you are expecting.

    git add -A
    git commit -m "my changes"
    git checkout master
    

    your file will be what it was before you branched.

    You can flip between 2 last branches you had checked out by repeatedly doing

    git checkout -
    

    this is also true of cd.

    Take a look at http://progit.org/book for info about the working directory and index.

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

Sidebar

Related Questions

I have a git branch (called v4), that was made from master just yesterday.
let's say I have the following config file [branch master] remote = origin merge
I have two files: master/newsletter1/file.html master/newsletter2/file.html newsletter1/file.html has a lot of new changes that
I have a Master Page which has an associated css file. On one of
I have merged master into my bugXY branch, and needed to merge a file.
I have a matlab script, lets call it master.m, that loads a file called
My local tree has diverged from the master: $ git status # On branch
I have a file, foo.txt Create and checkout branch 'branch_A' git mv foo.txt bar.txt
I have created a project called zz and it has a single file called
I have a file called test_module.c that has some differences that I want to

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.