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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T07:21:25+00:00 2026-06-08T07:21:25+00:00

I created a test branch on a master branch and made some commits on

  • 0

I created a test branch on a master branch and made some commits on it. Among these commits there were auto-formatting changes. So when I type
git diff master test
I can see almost every line with old formatting removed (- in red) and added (+ in green) a new line with a new formatting.

I would like to keep my changes on a test branch but I would like to restore the old formatting. Is that even possible? Does git know which new lines correspond to the old lines? If the line was modified it would be easy to do, but git diff displays it as a removed and then an added line – like they had nothing in common in git’s mind.

I tried various merge strategies, but it seems that this problem needs something more.

  • 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-08T07:21:26+00:00Added an answer on June 8, 2026 at 7:21 am

    Small hint. If you want to view diff between two banches ignoring whitespace changes use
    git diff -b instead of git diff.

    Back to your question. It is really depends on how changes were committed. If you committed useful improvements and reformatting separatly, then it is possible to revert reformattings. You just need to revert one or several commits. Otherwise I don’t think it is possible to do automatcly. Thow there are several options in git diff you can find youseful.

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

Sidebar

Related Questions

A new branch from master is created, we call it test . There are
I created a tracking branch so whowasout.com tracked whowasout.com/master $ git remote -v origin
I have made several commits in the master branch and then merged them to
I created a empty test project (static library type) with enabling the unit test.
I have created total 50 test scripts. All these scripts use almost same objects
I am discovering how to use git. I just made the following test: create
I want to create a git branch that will work independent of the master
I have two remote branches in git, master and test . master reflects whatever
I created new remote git repository and already pushed something in there - first
I created a test application that generates 10k random numbers in a range from

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.