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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T20:46:46+00:00 2026-05-24T20:46:46+00:00

Often while working on a branch I need to introduce some temporary changes (such

  • 0

Often while working on a branch I need to introduce some “temporary” changes (such as additional debugging info, or a change which lets me better observe the thing i’m actually working on).

About these “temporary” changes:

  • I want them in my working copy of my branch, because they help me to work on the actual change,
  • I don’t want them committed to the branch, because the branch is going to be merged into master some time and they’re not production code.

Currently I just keep them as unstaged and I skip them manually when staging every commit. However I can’t stay with this solution because:

  • All the time I have to remember which files I need to skip,
  • Someday I’m going to end up with 2 changes in one file, one being temporary, one to be committed, and it’s going to be really troublesome.

How should I deal with it?


gitignore is obviously out of the question because I don’t want to ignore the whole files and I’m still interested in changes from other committers (I need to rebase the branch to master from time to time).

  • 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-05-24T20:46:46+00:00Added an answer on May 24, 2026 at 8:46 pm

    I typically deal with this by using:

    git add -p
    

    … to stage changes hunk-by-hunk. Then you just have to make sure to press n for your debugging changes.


    If I have more involved changes of this type, I’ll create a branch called something like local-changes with a commit at its tip that introduces the debugging code. After creating a few more commits, I’d then use:

    git rebase -i master
    

    … to reorder them so that the commit with the local changes is at the tip again. Then to update master and return to the local changes branch, you can do:

    git checkout master
    git merge local-changes^
    git checkout local-changes
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

While developing products, we often need to create proprietary tools to test some of
I often use this code pattern: while(true) { //do something if(<some condition>) { break;
I often jump from a file to file, while working a large codebase. I
In the field I often need to perform remote debugging on a target PC
While working on projects, I often come to the dilemma of working on UI
Often while editing config files, I'll open one with vi and then when I
While creating classes in Java I often find myself creating instance-level collections that I
Code like this often happens: l = [] while foo: # baz l.append(bar) #
While searching the interweb for a solution for my VB.net problems I often find
While learning different languages, I've often seen objects allocated on the fly, most often

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.