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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T13:11:02+00:00 2026-06-10T13:11:02+00:00

Say, if the file foo is committed already, having the content of just a

  • 0

Say, if the file foo is committed already, having the content of

just a simple line

now a git checkout -b issue57 is done to create a branch and switch to it (say, that issue57 branch is to last 2 days for development), and a line footer added is added to the file for now, and then a git commit -a -m "add a footer to the file".

So now the file foo has the content

just a simple line
footer added

When a “hot fix” or “quick fix” is needed, I thought the command git checkout master should be used, and now the content of the file foo should be back to that just one single line. But when I do more foo, the file has both lines, why is 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-10T13:11:03+00:00Added an answer on June 10, 2026 at 1:11 pm

    Works just fine for me:

    $ more foo
    just a simple line
    $ echo "footer added" >> foo
    $ git checkout -b issue57
    M   foo
    Switched to a new branch 'issue57'
    $ git commit -a -m "add a footer to the file"
    [issue57 c397054] add a footer to the file
    1 file changed, 1 insertion(+)
    $ more foo
    just a simple line
    footer added
    $ git checkout master
    $ more foo
    just a simple line
    

    Maybe you have committed the file before git checkout -b issue57?

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

Sidebar

Related Questions

I have a file, let's say file.txt I have done git mv file.txt to
Say I do git add foo.txt Now, foo's changes are in the index (I'm
Let's say I have a very simple C file (called foo.c): int main() {
I have a file say foo.txt. Say, it's SHA-256 is SHA(foo.txt). Now, I divide
Let's say I have a really large file foo.txt and I want to iterate
Let's say the source file name is Foo.txt . I want the name of
Say a user visits the page http://somedomain.com/path/file.html#foo , I'd like to display, using JavaScript,
I want to execute a random .py file, say foo.py on the myproject/myapp folder
Say I have a MATLAB object defined in a class file classdef foo properties
Let's say that I have a file (file1.php) with a simple form with the

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.